Skip to content

Instantly share code, notes, and snippets.

Does an order always map to one subscription? Or can it have many subscriptions?

/**
* Simple regex/user agent mobile checker
* about 99% accurate when compared to 175k sessions in GA
*/
function isMobile()
{
return window.navigator.match(/Mobi|Touch|Opera\ Mini|Android/)
}
@lordhumunguz
lordhumunguz / add_tap_gesture.swift
Last active August 29, 2015 14:25
[iOS] Add Tap Gesture Recognizer
// confirm to the tap gesture recognizer delegate
func addTapGestureRecognizerForPausingWorkout() {
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: "workoutVideoTapped:")
tapGestureRecognizer.numberOfTapsRequired = 1
tapGestureRecognizer.delegate = self
self.view.addGestureRecognizer(tapGestureRecognizer)
}
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool { return true }
@lordhumunguz
lordhumunguz / reference.swift
Created May 11, 2015 08:01
[iOS] Data Persistence
// ## NSUserDefaults
// Storing a value in NSUserDefaults
NSUserDefaults.standardUserDefaults().defaults.setFloat(22.5 forKey: “myValue”)
// Retrieving a value from NSUserDefaults
let value = NSUserDefaults.standardUserDefaults().floatForKey(“myValue”)
// ## File System
@lordhumunguz
lordhumunguz / table.css
Created April 6, 2015 21:48
Mobile <table> cards
body {
font-family: arial;
}
table {
border: 1px solid #ccc;
width: 100%;
margin:0;
padding:0;
border-collapse: collapse;
@lordhumunguz
lordhumunguz / config.rb
Last active August 29, 2015 14:18
Basic middleman configs
require 'slim'
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Any arbitrary values. You can directly call these in your template
@lordhumunguz
lordhumunguz / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lordhumunguz
lordhumunguz / engine_api.md
Created July 25, 2014 22:56
Creating Rails Engine for rails-api

rails plugin new engines/cms --no-full --mountable --database=postgresql --skip-test-unit --skip-action-view -skip-sprockets --skip-javascript

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def index
render text: index_html
end
private
def index_html
@lordhumunguz
lordhumunguz / Sample_Gruntfile.coffee
Last active August 29, 2015 14:02
A sample grunt file for {blog url}
module.exports = (grunt) ->
timestamp = Date.now().toString()
grunt.initConfig
env: grunt.file.readJSON '.env.json'
s3:
options:
key: '<%= env.AWS.AccessKeyId %>'
secret: '<%= env.AWS.SecretKey %>'