This file contains 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
function doGet(request) { | |
var output = ContentService.createTextOutput(); | |
var data = {}; | |
var id = "ID"; | |
var sheet = "SHEETNAME"; | |
var ss = SpreadsheetApp.openById(id); | |
if (sheet) { | |
data = readData_(ss, sheet); | |
} | |
output.setContent(JSON.stringify(data)); |
This file contains 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
function getTickets() { | |
var sheet = SpreadsheetApp.openById("SPREADSHEET_ID").getSheetByName("SHEET_NAME_WITH_SUM"); | |
var count = sheet.getRange("LOCATION_OF_CELL"); | |
return count.getValue(); | |
} | |
function doGet() { | |
var result = { | |
"TITLE_OF_SUM":this.getTickets() |
This file contains 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
class LocalizedString < HashWithIndifferentAccess | |
def self.from_mongo(value) | |
value.is_a?(String) ? value : LocalizedString.new(value || {}) | |
end | |
def available_locales | |
symbolize_keys.keys | |
end | |
def to_s |
This file contains 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
>> f = Foo.new({:title => "Title"}) | |
NoMethodError: undefined method `translations' for "Title":String | |
from /Volumes/MEDIA/projects/oratsouyts/lib/LocalizedString.rb:19:in `to_mongo' | |
from /Library/Ruby/Gems/1.8/bundler/gems/mongomapper-b3ab248dd907/lib/mongo_mapper/plugins/keys/key.rb:51:in `set' | |
from /Library/Ruby/Gems/1.8/bundler/gems/mongomapper-b3ab248dd907/lib/mongo_mapper/plugins/keys.rb:310:in `write_key' | |
from /Library/Ruby/Gems/1.8/bundler/gems/mongomapper-b3ab248dd907/lib/mongo_mapper/plugins/dirty.rb:59:in `write_key' | |
from (eval):10:in `title=' | |
from /Library/Ruby/Gems/1.8/bundler/gems/mongomapper-b3ab248dd907/lib/mongo_mapper/plugins/keys.rb:183:in `send' | |
from /Library/Ruby/Gems/1.8/bundler/gems/mongomapper-b3ab248dd907/lib/mongo_mapper/plugins/keys.rb:183:in `attributes=' | |
from /Library/Ruby/Gems/1.8/bundler/gems/mongomapper-b3ab248dd907/lib/mongo_mapper/plugins/keys.rb:181:in `each_pair' |
This file contains 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
$.getJSON('http://www.oratsouyts.com/day.js?callback=?', function(data) { | |
var readings = [] | |
if(data.length > 0) { | |
$.each(data[0].readings, function(key,val) { | |
readings.push('<li><a href="http://www.oratsouyts.com/day/'+ data[0].date +'/passage/show/'+data[0].readings[key].passage+'">' + data[0].readings[key].title + '</a></li>'); | |
}) | |
$("<h4 />", {html: "Today is the <strong><a href='http://www.oratsouyts.com/day/"+data[0].date+"'>"+data[0].title+"</a></strong>"}).appendTo("#HomePage_Today"); | |
$("<ul/>", { html: readings.join('') }).appendTo("#HomePage_Today"); | |
} else { | |
$("<h4 />", {html: "No readings found for today"}).appendTo("#HomePage_Today"); |
This file contains 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
BEGIN { print "days:" } | |
/ ([a-zA-Z]*)/ { | |
monthtext = $2; | |
m["January"] = 1; | |
m["February"] = 2; | |
m["March"] = 3; | |
m["April"] = 4; | |
m["May"] = 5; | |
m["June"] = 6; | |
m["July"] = 7; |
This file contains 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
# Changes into the project's directory. All of my projects are stored in | |
# $PROJECTDIR/. Some of them are still on subversion, thus the need for all | |
# of the checks on "trunk". They often have one or more of the following | |
# subdirectories: application, prototype, mockups, artwork, or website. | |
# The command takes to parameters: the name of the project and the sub- | |
# directory. The application subdirectory is assumed if nothing is passed. | |
PROJECTDIR=/Volumes/MEDIA/projects |
This file contains 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
<h4> Բառարան </h4> | |
<dl> | |
<dt>XHTML / HTML</dt> | |
<dd>գերտեքստային նշման լեզու</dd> | |
<dt>Tags</dt> | |
<dd>HTML-ի հիմունքներ.</dd> | |
</dl> | |
<h4>HTML Տեղեկագրություն</h4> | |
<dl> |
This file contains 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
db = Connection.new(ENV['DATABASE_URL']).db(db_name) | |
if ENV['DATABASE_USER'] && ENV['DATABASE_PASSWORD'] | |
auth = db.authenticate(ENV['DATABASE_USER'], ENV['DATABASE_PASSWORD']) | |
end |
This file contains 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
# Convert a Gemfile to Heroku's .gems file plus config.gem statements for Rails 2.3 | |
herokuconfig = "" | |
railsconfig = "" | |
gemfile = File.new("Gemfile") | |
gemfile.readlines.each do |line| | |
if line =~ /gem ['"](\w+)['"](?:, ['"](.+?)['"]){0,1}(?:, :require => ['"](.+?)['"]){0,1}/ | |
herokuconfig << "#{$1}" + ($2 ? %Q( --version "#{$2}") : '') + "\n" | |
railsconfig << "config.gem '#{$1}'" + ($2 ? ", :version => '#{$2}'" : '') + ($3 ? ", :lib => '#{$3}'" : '') + "\n" |
NewerOlder