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 'net/http' | |
# Extend img tag to optionally embed images in-line into HTML instead of referencing as a URI | |
# | |
# This is a useful technique when sending HTML emails as it circumvents the prompt many mail clients | |
# present seeking permission to 'display images from this sender?' when an email of mime-type 'html' | |
# contains <img> tags. | |
# | |
# ie. <%= image_tag('red_dot.gif', :embed_inline => "true") %> | |
# |
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 'rspec' | |
def format_money(amount) | |
'-1' #TODO | |
end | |
describe "format_money" do | |
context "when the amount is a simple fraction" do | |
subject{ 0.4 } | |
specify{ format_money(subject).should == "$0.40" } |
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 GooglePlayVerification | |
require 'google/api_client' | |
# Refer: | |
# https://code.google.com/p/google-api-ruby-client/issues/detail?id=72 | |
# and | |
# http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html | |
# and | |
# http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/ | |
GOOGLE_KEY = 'xxx-xxx.apps.googleusercontent.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
type mogrify >/dev/null 2>&1 || { echo >&2 "» This script requires mogrify. Please install ImageMagick first!"; exit 1; } | |
rm -rf Resources/android/images | |
mkdir Resources/android/images | |
mkdir Resources/android/images/res-xhdpi | |
mkdir Resources/android/images/res-mdpi | |
echo " » Copying the splash screen" | |
cp Resources/iphone/Default.png Resources/android/images/res-mdpi/default.png | |
cp Resources/iphone/[email protected] Resources/android/images/res-xhdpi/default.png |
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
function isTablet(){ | |
if(!Ti.Android){ | |
return Ti.Platform.osname === 'ipad'; | |
} | |
// http://www.libtronics.com/2013/10/determining-if-device-is-tablet-on.html | |
var height = Ti.Platform.displayCaps.platformHeight; | |
var width = Ti.Platform.displayCaps.platformWidth; | |
if (height < width){ | |
var w_inch = height / Ti.Platform.displayCaps.xdpi; |
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
# This class shows uses version 0.28.7 of the ruby google-api-client gem circa April 2019 | |
# to query the Google Play subscription API. | |
# | |
# If using an older version of the google-api-client gem (ie. version 0.8.x), instead refer to: | |
# https://gist.github.com/jkotchoff/e60fdf048ec443272045/e3e2c867633900d9d6f53de2de13aa0a0a16bb03 | |
# | |
# Sample usage: | |
# | |
# package_name = 'com.stocklight.stocklightapp' | |
# product_id = 'com.stocklight.stocklight.standardsubscription' |
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 'urbanairship' | |
require 'httparty' | |
Urbanairship.application_key = '...' | |
Urbanairship.application_secret = '...' | |
Urbanairship.master_secret = '...' | |
response = Urbanairship.device_tokens |
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 'aws-sdk' | |
# This code snippet sends a push notification to a device using the Amazon SNS service. | |
# | |
# It is using the preview V2 amazon gem as per: | |
# https://aws.amazon.com/sdk-for-ruby/ | |
# | |
# This was installed using: | |
# $ gem install aws-sdk --pre |
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
var win = Ti.UI.createWindow({title: 'listview test', backgroundColor: 'white', extendEdges: [Ti.UI.EXTEND_EDGE_TOP]}); | |
var listView = Ti.UI.createListView({height:'90%', top:0}); | |
var sections = []; | |
var TOP_OFFSET = 64; | |
listView.setContentInsets({top:TOP_OFFSET}, {animated:false}); | |
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'}); | |
var fruitDataSet = [ | |
{properties: { title: 'Apple'}}, |
OlderNewer