I create a little jQuery/Zepto “plugin” function:
$.fn.onClickOrTouch = (callback) ->
if window.ontouchend != undefined # insanely clever touch detection
this.each -> this._touchMoveCount = 0
#!/bin/bash | |
# A simple script to backup an organization's GitHub repositories. | |
#------------------------------------------------------------------------------- | |
# NOTES: | |
#------------------------------------------------------------------------------- | |
# * User @jimklimov (and probably some others called out in the long comment | |
# thread below) have modified this script to make it more robust and keep | |
# up with various changes in the GitHub API and response format at: | |
# https://github.com/jimklimov/github-scripts |
function isRetina(){ | |
return (('devicePixelRatio' in window && devicePixelRatio > 1) || | |
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches)) | |
} |
<!-- example for the http://retinafy.me ebook --> | |
<style> | |
div.rss { | |
background: url(rss.svg); | |
width: 32px; | |
height: 32px; | |
} | |
body.no-svg div.rss { |
head, meta[name="description"], meta[property^="og:"] { display: block } | |
head { | |
position: relative; | |
z-index: 9999; | |
font: 21px/1.4 Didot; | |
color: #444; | |
-webkit-hyphens: auto; | |
padding: 2em; | |
background: #fff; | |
-webkit-font-smoothing: subpixel-antialiased; |
guard 'shell' do | |
watch(/(^src\/haml\/(.+)\.haml)/) do |match| | |
puts match[0] + " changed at " + Time.now.strftime("%H:%M:%S") +". Re-generating HTML from HAML" | |
`haml #{match[1]} #{match[2]}.html` | |
`terminal-notifier -group 'haml' -title 'Regenerating Coffeescript' -message '#{match[0]}'` | |
end | |
watch(/(^src\/sass\/.+)/) do |match| | |
puts match[0] + " changed at " + Time.now.strftime("%H:%M:%S") +". Re-generating CSS from SASS." | |
`Compass compile` |
$coupon_code = 'UNIQUECODE'; // Code | |
$amount = '10'; // Amount | |
$discount_type = 'fixed_cart'; // Type: fixed_cart, percent, fixed_product, percent_product | |
$coupon = array( | |
'post_title' => $coupon_code, | |
'post_content' => '', | |
'post_status' => 'publish', | |
'post_author' => 1, | |
'post_type' => 'shop_coupon' |
/** | |
* Add dataset support to elements | |
* No globals, no overriding prototype with non-standard methods, | |
* handles CamelCase properly, attempts to use standard | |
* Object.defineProperty() (and Function bind()) methods, | |
* falls back to native implementation when existing | |
* Inspired by http://code.eligrey.com/html5/dataset/ | |
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js ) | |
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (polyfills below) | |
* All code below is Licensed under the X11/MIT License |
# config/initializers/tumbz_init.rb | |
Tumbz.configure do |config| | |
config.access_key = "foo" | |
config.access_secret = "bar" | |
end | |
# lib/tumbz.rb | |
module Tumbz | |
def self.configure | |
@options = OpenStruct.new |
#!/usr/bin/ruby | |
require 'csv' | |
require 'erb' | |
require 'cgi' | |
if ARGV.length == 2 | |
input_csv = ARGV[0] | |
output_te = ARGV[1] | |
unless output_te =~ /\.textexpander$/ | |
puts "Second argument must have a '.textexpander' extension." |