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
{ | |
"cards":[ | |
{ | |
"type":"place", | |
"title":"McDonald's", | |
"imageURL":"http://upload.wikimedia.org/wikipedia/commons/thumb/1/17/DowneyMcdonalds.jpg/240px-DowneyMcdonalds.jpg", | |
"placeCategory":"Fast Food" | |
}, | |
{ | |
"type":"movie", |
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
// Array of ordinals (ASCII character posistions) | |
NSArray *keyStringCharacterOrdinals = @[@99, @109,.....]; | |
NSMutableString *keyString = [[NSMutableString alloc] initWithCapacity:keyStringCharacterOrdinals.count]; | |
for (NSNumber *characterOrdinal in keyStringCharacterOrdinals) { | |
[keyString appendString:[NSString stringWithFormat:@"%c", characterOrdinal.intValue]]; | |
} |
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
<a href="http://salty-hollows-7859.herokuapp.com/"> |
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 'oauth2' | |
client = OAuth2::Client.new('client_id', 'client_secret', :site => 'https://example.org') | |
client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback') | |
# => "https://example.org/oauth/authorization?response_type=code&client_id=client_id&redirect_uri=http://localhost:8080/oauth2/callback" | |
token = client.auth_code.get_token('authorization_code_value', :redirect_uri => 'http://localhost:8080/oauth2/callback', :headers => {'Authorization' => 'Basic some_password'}) | |
response = token.get('/api/resource', :params => { 'query_foo' => 'bar' }) | |
response.class.name | |
# => OAuth2::Response |
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
namespace :generate do | |
desc 'Generate FLMS views in host app for additional styling' | |
task :views do | |
host_view_dir = File.expand_path("../../../app/views/flms/*", __FILE__) | |
unless Dir.exists?("app/views/flms") | |
FileUtils.mkdir "app/views/flms" | |
FileUtils.cp_r Dir[host_view_dir], "app/views/flms/" | |
end | |
end | |
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
import Control.Monad | |
import Data.List | |
import Primes | |
primes4 = takeWhile (<10000) $ dropWhile (<1000) primes | |
result = do | |
a <- primes4 | |
b <- dropWhile (<= a) primes4 | |
guard ((sort $ show a) == (sort $ show b)) |
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
public void executeAsyncGet(View view) { | |
AsyncHttpClient client = new AsyncHttpClient(); | |
RequestParams params = new RequestParams(); | |
params.put("latitude", "40.192512"); | |
params.put("longitude", "-83.526306"); | |
params.put("distance_in_miles", "10000"); | |
client.get("http://redlights.herokuapp.com/in_proximity_of",params ,new JsonHttpResponseHandler() { | |
@Override | |
public void onSuccess(JSONArray red_lights) { | |
for (int i = 0; i < red_lights.length(); i++) { |
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 FizzBuzz | |
def initialize(lower_bound,upper_bound) | |
@lower_bound = lower_bound | |
@upper_bound = upper_bound | |
end | |
def evaluate | |
(@lower_bound..@upper_bound).map do |x| | |
if (x % 5) == 0 && (x % 3) == 0 | |
"FizzBuzz" | |
elsif (x % 5) == 0 |
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
import com.github.kevinsawicki.http.HttpRequest; | |
public class HTTPCaller { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub |
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
// ajax call | |
req = $.get('/get_assets',{company_id: $(this).dataset.company}); | |
req.success(function(data){ | |
JST['template name'] | |
assets: data | |
}) | |
//template call | |
<img src="{{it.assets.pic1}}"<img> | |
NewerOlder