Skip to content

Instantly share code, notes, and snippets.

{"version":20160705,"token":"ANDP","cardholder_name":"paul h","billing_address":{"street_address":"799 Market St","locality":"San Francisco","region":"California","postal_code":"94103","country_code_alpha2":"US","first_name":"paul h"}}
extension String {
public var isPresent: Bool {
return !isEmpty
}
}
private func didTapSubmit() -> GAMComponentActionButton.Config.ButtonTapClosure {
return {
print("YOLO")
}
}
private func actionButtonConfig() -> GAMComponentActionButton.Config {
return GAMComponentActionButton.Config(title: "Submit",
backgroundColor: GTColor.black.absolute,
buttonTapClosure: didTapSubmit()
//
// SCSocialTextView.m
// Socialcast
//
// Created by Mike Silvis on 12/10/14.
// Copyright (c) 2014 Socialcast. All rights reserved.
//
#import "SCSocialTextView.h"
#import "SCColorScheme.h"
@MikeSilvis
MikeSilvis / AppStore.js
Last active August 29, 2015 14:06
Search the Apple Store for arbitrary data. Does not rely on jQuery, or any other libraries
window.AppStoreSearch = {
find: function(config) {
var script = document.createElement('script');
AppStoreSearch.callBack = config.callBack;
script.src = '//itunes.apple.com/lookup?id=' + config.id + '&callback=AppStoreSearch.callBack'
document.getElementsByTagName('head')[0].appendChild(script);
}
};
class Object
def call_me_maybe
`open http://www.youtube.com/watch?v=fWNaR-rxAic`
end
end
1.9.3p448 :001 > def hello
1.9.3p448 :002?> def world
1.9.3p448 :003?> puts 'world'
1.9.3p448 :004?> end
1.9.3p448 :005?> puts 'hello'
1.9.3p448 :006?> end
=> nil
1.9.3p448 :007 > hello
hello
=> nil
2.0.0p247 :001 > v = Vehicle.first
Vehicle Load (1.1ms) SELECT "vehicles".* FROM "garages" LIMIT 1
=> #<Vehicle id: 3, model_id: 1, year: 2013, color_id: 9, user_id: 2, created_at: "2013-07-06 20:03:52", updated_at: "2013-07-06 20:03:52">
2.0.0p247 :002 > v.model
Model Load (1.0ms) SELECT "models".* FROM "models" WHERE "models"."id" = 1 LIMIT 1
=> #<Model id: 1, name: "e90 M3 Sedan", make_id: 12, created_at: "2013-05-30 05:05:21", updated_at: "2013-07-15 03:58:05">
2.0.0p247 :003 > v.make
Make Load (0.7ms) SELECT "makes".* FROM "makes" WHERE "makes"."id" = 12 LIMIT 1
=> #<Make id: 12, name: "BMW", created_at: "2013-05-30 05:06:18", updated_at: "2013-05-30 05:06:18">
2.0.0p247 :004 > v.color
@MikeSilvis
MikeSilvis / results
Last active December 19, 2015 19:08
Benchmarking Ruby's Set .include? Vs Array .include?. The results are incredible.
➲ ruby set.rb "500"
user system total real
0.150000 0.000000 0.150000 ( 0.149935)
0.150000 0.000000 0.150000 ( 0.153456)
0.000000 0.000000 0.000000 ( 0.000085)
0.000000 0.000000 0.000000 ( 0.000081)
1.9.3 Desktop
➲ ruby set.rb "5000"
user system total real
class HelloController
before_filter :find_market
def index
end
private
def find_market
@market = Market.find(params[:id])
end