This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var distance_of_time_in_words, time_ago_in_words; | |
time_ago_in_words = function(from_time, include_seconds) { | |
if (include_seconds != null) { | |
include_seconds; | |
} else { | |
include_seconds = false; | |
}; | |
return App.distance_of_time_in_words(from_time, Date.now(), include_seconds); | |
}; | |
distance_of_time_in_words = function(from_time, to_time, include_seconds) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
csv_text = File.read('...') | |
csv = CSV.parse(csv_text, :headers => true) | |
csv.each do |row| | |
Model.create!(row.to_hash) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.typeahead').focus().typeahead('val', '').focus().typeahead('val', 'what ever value you want to test'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.config.assets.paths |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof(some_variable) != 'undefined' && some_variable != null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
file = "#{Rails.root}/data.csv" | |
schools = School.where(state_code: 'CO').order('name ASC') | |
CSV.open( file, 'w' ) do |writer| | |
schools.each do |s| | |
writer << [s.name, s.zipcode, s.id] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func deviceRemainingFreeSpaceInBytes() -> Int64? { | |
let documentDirectoryPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) | |
let systemAttributes = NSFileManager.defaultManager().attributesOfFileSystemForPath(documentDirectoryPath.last as String, error: nil) | |
let freeSize = (systemAttributes?[NSFileSystemFreeSize] as? NSNumber)?.longLongValue | |
return freeSize | |
} | |
if let bytes = deviceRemainingFreeSpaceInBytes() { | |
println("free space: \(bytes)") | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSV.open("myfile.csv", "w") do |csv| | |
csv << BusinessService.column_names | |
BusinessService.all.each do |m| | |
csv << m.attributes.values | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$bootstrap-sass-asset-helper: false !default; | |
// | |
// Variables | |
// -------------------------------------------------- | |
//== Colors | |
// | |
//## Gray and brand colors for use across Bootstrap. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grant all privileges on mydb.* to myuser@'%' identified by 'mypasswd'; |