Skip to content

Instantly share code, notes, and snippets.

View moughxyz's full-sized avatar
💭
I may be slow to respond.

Mo moughxyz

💭
I may be slow to respond.
View GitHub Profile
@ksafranski
ksafranski / Common-Currency.json
Last active April 23, 2025 09:47
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@albertodebortoli
albertodebortoli / gist:2602966
Created May 5, 2012 14:39
JSON to NSManagedObject and viceversa (concept)
- (NSString*)jsonStructureFromManagedObjects:(NSArray*)managedObjects;
- (NSArray*)managedObjectsFromJSONStructure:(NSString*)json withManagedObjectContext:(NSManagedObjectContext*)moc;
- (NSDictionary*)dataStructureFromManagedObject:(NSManagedObject*)managedObject
{
NSDictionary *attributesByName = [[managedObject entity] attributesByName];
NSDictionary *relationshipsByName = [[managedObject entity] relationshipsByName];
NSMutableDictionary *valuesDictionary = [[managedObject dictionaryWithValuesForKeys:[attributesByName allKeys]] mutableCopy];
[valuesDictionary setObject:[[managedObject entity] name] forKey:@"ManagedObjectName"];
for (NSString *relationshipName in [relationshipsByName allKeys]) {
@wrburgess
wrburgess / gist:2187164
Created March 24, 2012 19:37
Setting up a Rails has_many :through relationship with meaningful relationship table #rails #activerecord #relations

##References

##Create Models

Create tables:

rails g model Location
rails g model User
rails g model Checkin
@rajeshg
rajeshg / meta-fetcher.rb
Created October 15, 2010 19:46
Quick little script to fetch all the meta tags from a website and export them to excel
#!/usr/bin/ruby -w
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'spreadsheet'
class MetaReader
attr_reader :url, :outFile, :links, :book, :sheet1, :rownum
attr_accessor :url, :outFile, :links, :book, :sheet1, :rownum