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/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/) | |
} |
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
// 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 } |
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
// ## 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 |
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
body { | |
font-family: arial; | |
} | |
table { | |
border: 1px solid #ccc; | |
width: 100%; | |
margin:0; | |
padding:0; | |
border-collapse: collapse; |
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 'slim' | |
### | |
# Helpers | |
### | |
# Automatic image dimensions on image_tag helper | |
# activate :automatic_image_sizes | |
# Any arbitrary values. You can directly call these in your template |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
rails plugin new engines/cms --no-full --mountable --database=postgresql --skip-test-unit --skip-action-view -skip-sprockets --skip-javascript
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 ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def index | |
render text: index_html | |
end | |
private | |
def index_html |
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
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 %>' |
NewerOlder