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
# Simple regex to replace ruby rocket-syntax hash keys with JSON style. | |
# e.g. Replace :some_key => "value" with some_key: "value" | |
# | |
# (Tested in sublime) | |
/:([a-zA-Z0-9_-]*)(( *)=>\ *)/$1: / |
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 'rubygems' | |
require 'fog' | |
# Configuration | |
CONTAINER_NAME = "your_container_name" | |
IGNORE_TYPES = ["application/directory"] | |
MAX_TRIES = 3 | |
CF_USERNAME = "your_rackspace_username" | |
CF_API_KEY = "your_rackspace_api_key" |
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
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 21 | |
buildToolsVersion "21.1.1" | |
defaultConfig { | |
applicationId "com.plymouthsoftware.android.volleyapp" | |
minSdkVersion 8 | |
targetSdkVersion 21 |
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 class ProductsActivity extends Activity { | |
// ... | |
// onCreate(), etc. | |
// ... | |
/** | |
* Assuming a JSON feed similar to: | |
* { | |
* "products": [ |
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
{ | |
"message": "JSON Response OK", | |
"code": 200, | |
"images": [ | |
{ | |
"url": "http://assets.chrisblunt.com/wp-content/uploads/2012/12/IMG_20120619_202506-e1356946615784.jpg", | |
"title": "Hand Sunset" | |
}, | |
{ | |
"url": "http://assets.chrisblunt.com/wp-content/uploads/2010/01/PC280118.jpg", |
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
Object.extend(String.prototype, { | |
/** | |
* Converts an underscore string into object attribute format for submission | |
* to a server (Based on Rails). | |
* | |
* To attributize the string client_firstName | |
* "client_firstName".attributize() | |
* => client[first_name] | |
* | |
* To attributize the string client_addresses__street |
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
# app/helpers/application_helper.rb | |
def sanitized_object_name(object_name) | |
object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") | |
end | |
def sanitized_method_name(method_name) | |
method_name.sub(/\?$/, "") | |
end | |
def form_tag_id(object_name, method_name) |
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
Factory.define :application do |factory| | |
factory.attachment :sample, "public/samples/sample.doc", "application/msword" | |
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
adb shell pm list packages |
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
# DEPRECATED: use https://gist.github.com/cblunt/1042832 | |
# rails new my-app -m [raw url to this file] | |
gem 'json' | |
# Slim template | |
gem 'slim-rails' | |
gem 'simple_form' |
OlderNewer