Skip to content

Instantly share code, notes, and snippets.

View jpsirois's full-sized avatar

Jean-Philippe Sirois jpsirois

View GitHub Profile
@rodw
rodw / backup-github.sh
Last active September 18, 2025 08:55
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/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
@rafbm
rafbm / onclickortouch.md
Created July 9, 2012 15:01
This is how I handle snappy taps on iOS.

This is how I handle snappy taps on iOS.

I create a little jQuery/Zepto “plugin” function:

$.fn.onClickOrTouch = (callback) ->
  if window.ontouchend != undefined # insanely clever touch detection
    this.each -> this._touchMoveCount = 0
@madrobby
madrobby / gist:3161015
Created July 22, 2012 20:43
Detect retina support. Tested on iOS, Android 2.x, Chrome for Android, Safari on MacBook Pro Retina, Firefox mobile (beta) for Android, Opera Mobile (Android)
function isRetina(){
return (('devicePixelRatio' in window && devicePixelRatio > 1) ||
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches))
}
@madrobby
madrobby / gist:3202087
Created July 29, 2012 22:01
Fallback to PNG if SVG is not supported
<!-- example for the http://retinafy.me ebook -->
<style>
div.rss {
background: url(rss.svg);
width: 32px;
height: 32px;
}
body.no-svg div.rss {
@rafbm
rafbm / meta-debug.css
Created August 27, 2012 01:04
CSS snippet for debugging meta descriptions and Open Graph tags with class
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;
@jpsirois
jpsirois / Guardfile
Last active October 11, 2015 04:07
Guardfile Exemple
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`
@mikejolley
mikejolley / gist:3969579
Created October 28, 2012 19:28
WooCommerce - Create a coupon via PHP
$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'
@brettz9
brettz9 / html5-dataset.js
Last active April 29, 2023 14:58
Dataset Shim
/**
* 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
@remi
remi / example.rb
Created December 6, 2012 18:38
Gathering options using a block
# 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
@ttscoff
ttscoff / textexpander_gen.rb
Last active February 20, 2025 10:02
Mass generate TextExpander snippets from a CSV file
#!/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."