Skip to content

Instantly share code, notes, and snippets.

@Override
public void render(final String json){
try{
JSONObject jsonObj = new JSONObject(json);
Iterator<?> keys = jsonObj.keys();
while(keys.hasNext()){
String key = (String)keys.next();
if(key.equalsIgnoreCase("inCurrencies")){
//TODO
@Override
public void render(final String json){
try{
JSONObject jsonObj = new JSONObject(json);
Iterator<?> keys = jsonObj.keys();
while(keys.hasNext()){
final String key = (String)keys.next();
final String value = jsonObj.getString(key);
this.runOnUiThread(new Runnable() {
package com.sample;
import com.calatrava.CalatravaPage;
import com.calatrava.shell.WebViewActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View;
@jwhitehorn
jwhitehorn / backronym.coffee
Created October 14, 2014 02:04
Backronym Generator
lineReader = require 'line-reader'
words = {}
abbreviation = ['a', 'b', 'c']
wordsForLetter = (thusFar, index) ->
letter = abbreviation[index]
for word in words[letter]
thusFar[index] = word
if index == abbreviation.length-1
{
"animals": [{
"id": "169853e4-882c-4a22-b86f-aa9671fed670",
"name": "Moose",
"color": "brown"
}, {
"id": "d29ab6ce-a15f-41b2-987c-ca40221dcb92",
"name": "Fish",
"color": "yellow"
}]
@jwhitehorn
jwhitehorn / nginx.conf
Created March 14, 2016 02:51
Nginx configuration for A+ SSL Labs score
user www-data;
worker_processes 4;
pid /run/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
}
http {
@jwhitehorn
jwhitehorn / save_restore_dependencies.sql
Last active March 2, 2017 16:23 — forked from mateuszwenus/save_restore_dependencies.sql
PostgreSQL: How to handle table and view dependencies
create table deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),
deps_view_name varchar(255),
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as
$$
var dbOpen = require('./database.js');
var async = require('async');
var tmp = require('tmp');
var fs = require('fs-extra');
var sqlite = require('sqlite3').verbose();
var tmpobj = tmp.fileSync(); //use a new, empty, temporary file
var sqliteDb = new sqlite.Database(tmpobj.name);
#import "AppDelegate.h"
#import "Sync.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
function(next){
sqliteDb.run("create table campgrounds (id integer, name text, latitude real, longitude real, rating real, address text, city text, state text, zip_code text)", next);
},
function(next){
sqliteDb.run("create table campground_photos (id integer, photo_url text, campground_id integer)", next);
},
function(next){
sqliteDb.run("create table campground_reviews (id integer, headline text, body text, rating text, campground_id integer)", next);
},