Skip to content

Instantly share code, notes, and snippets.

View EtienneLem's full-sized avatar

Etienne Lemay EtienneLem

View GitHub Profile
@rafbm
rafbm / css-compressor.js
Created August 27, 2011 19:26
CSS compressor
var compressCSS = function(css) {
return css.trim()
.replace(/\s*([{}:;,>+~])\s*/g, '$1') // whitespace
.replace(/;}/g, '}') // trailing semicolons
.replace(/#(\w)\1(\w)\2(\w)\3\b/g, '#$1$2$3') // hex colors
.replace(/(\[[^=]+=)("|')([^"'\s]+)(\2)(\])/g, '$1$3$5') // useless attribute selector quotes
.replace(/\(('|")([^"'\s]+)(\1)\)/g, '($2)') // useless function quotes
}
@RandomEtc
RandomEtc / 1-make-key
Created September 16, 2011 16:35
generating SSL keys and Certificate Signing Requests for Heroku / Nginx / RapidSSL
Key was generated using:
tom% openssl genrsa -des3 -out example.com.key 2048
Generating RSA private key, 2048 bit long modulus
....+++
..........................................................................................................................+++
e is 65537 (0x10001)
Enter pass phrase for example.com.key:
Verifying - Enter pass phrase for example.com.key:
%tom
@madrobby
madrobby / gist:1362093
Created November 13, 2011 13:04
Force rendering a DOM element when Webkit is acting up
forceRerenderOnWebkit: ->
@el.parentNode.style.cssText += ';-webkit-transform:rotateZ(0deg)'
@el.parentNode.offsetHeight
@el.parentNode.style.cssText += ';-webkit-transform:none'
@scottjehl
scottjehl / fixorientationzoom.js
Created January 6, 2012 00:27
Fix iOS Orientation Change Zoom Bug
/*
NOTE!!!!
The most updated version of this code is here:
https://github.com/scottjehl/iOS-Orientationchange-Fix
@mislav
mislav / aprompt.png
Last active February 11, 2024 06:40
My zsh prompt. No oh-my-zsh needed
aprompt.png
@rafbm
rafbm / .gitconfig
Created February 6, 2012 16:16
Sane aliases for `git reset`
[alias]
unstage = reset HEAD # unstage
clear = reset --hard HEAD # erase uncommited file edits (destructive!)
uncommit = reset HEAD~1 # erase last commit but keeps related file edits
rollback = reset --hard HEAD~1 # erase last commit and related file edits (destructive!)
@madrobby
madrobby / gist:2997187
Created June 26, 2012 17:13
The ultimate media query to rule them all ("all" being high DPI/"Retina" screens)
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
/* "retina" styles */
}
@simonprev
simonprev / gist:3044224
Created July 3, 2012 23:55
Fix my Rdio
1. Open terminal.app
2. Paste this command: defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
(credit: https://twitter.com/defaultswrite/status/220164244954554368)
3. Open Rdio.app
4. Right click and show the inspector panel
5. In the console section, paste this line: $("head").append('<link href="https://s3.amazonaws.com/simon-dev/css/rdio.css" rel="stylesheet" type="text/css">')
@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))
}