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
// decimal_arithmetic.js | |
// From http://www.brewsession.com/problematic-decimal-arithmetic-in-javascript/ | |
String.prototype.digitsAfterDecimal = function() | |
{ var parts = this.split(".", 2); // FIXME: Not international! | |
if( ! parts[1] ) | |
{ parts[1] = ""; } | |
return parts[1].length; | |
}; |
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
http://i.imgur.com/IhEFF.png | |
>>> var c = App.store.find(App.Citizen, 2); | |
{"citizen":{"biography":"Voter McVoter has nothing to say about herself","birth_date":null,"city":null,"country":null,"created_at":"2012-05-20T18:42:16Z","email":null,"first_name":"Voter","gender":"female","id":2,"invitation_id":2,"last_name":"McVoter","motto":null,"photo_content_type":null,"photo_file_name":null,"photo_file_size":null,"photo_updated_at":null,"region_state":null,"updated_at":"2012-05-20T18:42:16Z","zip":null}} | |
assertion failed: A data hash was loaded for a model of type App.Citizen but no primary key 'undefined' was provided. | |
deprecate(message="ember_assert is depreca...e Ember.assert instead.", test=false)ember.js?body=1 (line 94) | |
deprecateFunc()ember.js?body=1 (line 136) | |
load(type=App.Citizen, id=Object { biography="Voter McVoter has nothing to say about herself", created_at="2012-05-20T18:42:16Z", first_name="Voter", more...}, hash=Object { biography="Voter McVoter has nothing to say about herself", created_at="201 |
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
/* | |
* jsFiddle demo: http://bit.ly/NHVuBF | |
* | |
* Using ember.js built on 2012-06-17 | |
* from commit 1b0a2339184a9d583270eca84ee10056b269858c | |
* | |
* The following code produces an exception | |
* | |
* assertion failed: You need to provide an object and key to `set`. | |
* |
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
module JsonSerializationUnifier | |
# ActiveModel::Serializer only works in the controller's render method | |
# This modue replaces ActiveModel::Serializers with ActiveModel::Serializer | |
# yup, a little confusing. Include in in your model classes so to_json and | |
# as_json work as expected in the console and elsewhere. | |
extend ActiveSupport::Concern | |
def as_json(value=nil, use_options = true) | |
return active_model_serializer.as_json if active_model_serializer |
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
require 'koala' | |
me = Koala::Facebook::API.new 'AAAC...' # get this from https://developers.facebook.com/tools/explorer - get user_status,manage_pages permissions | |
pages = me.get_connections('me', 'accounts') | |
# Find your page's access token | |
nrb = Koala::Facebook::API.new 'AAAC...' # see acting as a page https://github.com/arsduo/koala/wiki/Acting-as-a-Page | |
feed = nrb.get_connection('me', 'tagged') |
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
require 'active_record/coders/yaml_column' | |
require 'active_support' | |
require 'yaml' | |
# This module defines an YAMLColumn coder that returns | |
# nil instead of a blank object. Useful when the class you are serializing | |
# to/from does not allow uninitialized objects (such as a unit measurement) | |
# | |
# See more: http://blog.deanbrundage.com/2012/10/rails-serialization-of-nil-values/ | |
# | |
module NilReturningCoder |
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
test: | |
adapter: sqlite3 | |
encoding: utf8 | |
pool: 5 | |
timeout: 5000 | |
database: ":memory:" | |
verbosity: quiet |
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
# | |
# Automatically generated file; DO NOT EDIT. | |
# Linux/sparc64 3.5.7-gentoo Kernel Configuration | |
# | |
CONFIG_64BIT=y | |
CONFIG_SPARC=y | |
# CONFIG_SPARC32 is not set | |
CONFIG_SPARC64=y | |
CONFIG_ARCH_DEFCONFIG="arch/sparc/configs/sparc64_defconfig" | |
CONFIG_BITS=64 |
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
require 'active_record' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.colorize_logging = false | |
ActiveRecord::Base.establish_connection( | |
:adapter => "sqlite3", | |
:database => ":memory:" | |
) |
OlderNewer