http://tomtomtom.org/networkmanager-openconnect/
Ruby on Rails
Friday, 13 October 2017
Monday, 9 October 2017
Tuesday, 25 July 2017
Heroku Commands
- db:migrate runs (single) migrations that have not run yet.
- db:create creates the database
- db:drop deletes the database
- db:schema:load creates tables and columns within the (existing) database following schema.rb
- db:setup does db:create, db:schema:load, db:seed
- db:reset does db:drop, db:setup
Typically,
you would use db:migrate after having made changes to the schema via
new migration files (this makes sense only if there is already data in
the database). db:schema:load is used when you setup a new instance of
your app.
I hope that helps.
UPDATE for rails 3.2.12:
I just checked the source and the dependencies are like this now:
- db:create creates the database for the current env
- db:create:all creates the databases for all envs
- db:drop drops the database for the current env
- db:drop:all drops the databases for all envs
- db:migrate runs migrations for the current env that have not run yet
- db:migrate:up runs one specific migration
- db:migrate:down rolls back one specific migration
- db:migrate:status shows current migration status
- db:rollback rolls back the last migration
- db:forward advances the current schema version to the next one
- db:seed (only) runs the db/seed.rb file
- db:schema:load loads the schema into the current env's database
- db:schema:dump dumps the current env's schema (and seems to create the db as well)
- db:setup runs db:schema:load, db:seed
- db:reset runs db:drop db:setup
- db:migrate:redo runs (db:migrate:down db:migrate:up) or (db:rollback db:migrate) depending on the specified migration
- db:migrate:reset runs db:drop db:create db:migrate
WunderGround API:
wu_data.rb
wu_data.rb
# encoding: UTF-8
require "json"
require "open-uri"
require_relative 'wu'
require_relative 'forecast_io'
class WuData
URL_API = "http://54.68.32.124"
def initialize
places = open(URL_API+"/sync_places"). read
@places = JSON.parse places
end
def get_wu
@wu_data = {}
@places.each do |place|
query_start_time = DateTime.now
_coords = "#{place["location"][0]}"+","+ "#{place["location"][1]}"
puts "#{_coords}=================== ="
wu = Wu.new(_coords)
wu_obj = wu.report
@wu_data[place["id"]] = wu_obj
sleep 1
puts " -> #{((DateTime.now - query_start_time) * 24 * 60 * 60).to_f}s"
end
end
def wu_json
File.open("wu_json/wu_data. json","w") do |f|
f.write(@wu_data.to_json)
end
end
end
wu = WuData.new
wu.get_wu
wu.wu_json
sync_data.rb
Phone type format with javascript
<script type='text/javascript' src='http://digitalbush.com/ wp-includes/js/jquery/jquery. js?ver=1.11.0'></script>
<script type="text/javascript" src="http://digitalbush.com/ wp-content/uploads/2014/10/ jquery.maskedinput.js"></ script>
<script>
jQuery(function($){
$(".phone").mask("(999) 999-9999");
});
</script>
<script type='text/javascript' src='http://digitalbush.com/
<script type="text/javascript" src="http://digitalbush.com/
<script>
jQuery(function($){
$(".phone").mask("(999) 999-9999");
});
</script>
File Handling operations (Read, Write, Open)
controller:-i
f !Dir.exists?("public/default_ sms")
default_sms(params)
else
update_sms(params)
end
def default_sms(params)
FileUtils.mkdir_p "#{Rails.public_path}/default_ sms"
@team_sms = File.open(Rails.root.join(" public/default_sms","team_sms. txt"), 'w') do |file|
file.write(params[: notification][:team_sms])
end
end
def update_sms(params)
FileUtils.mkdir_p "#{Rails.public_path}/update_ sms_#{current_user.id}"
@team_sms = File.open(Rails.root.join(" public/update_sms_#{current_ user.id}","team_sms_#{current_ user.id}.txt"), 'w') do |file|
file.write(params[: notification][:team_sms])
end
endf !Dir.exists?("public/default_
default_sms(params)
else
update_sms(params)
end
def default_sms(params)
FileUtils.mkdir_p "#{Rails.public_path}/default_
@team_sms = File.open(Rails.root.join("
file.write(params[:
end
end
def update_sms(params)
FileUtils.mkdir_p "#{Rails.public_path}/update_
@team_sms = File.open(Rails.root.join("
file.write(params[:
end
Dir.glob("public/update_sms_#{
Subscribe to:
Posts (Atom)