Skip to content

Instantly share code, notes, and snippets.

View pyrsmk's full-sized avatar
🤖
boop. boop. boop beep boop.

Aurélien Delogu pyrsmk

🤖
boop. boop. boop beep boop.
View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@wilmoore
wilmoore / sass_and_less_compared.markdown
Created February 10, 2011 06:17 — forked from chriseppstein/sass_and_less_compared.markdown
Sass/Less Comparison (updated 2011-02-09) -- thanks to chriseppstein for starting this

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For less, I'm using the ruby version because this is what they suggest on the website. The javascript version may be different.

Variables

@ttilley
ttilley / uacss.js
Created March 8, 2011 03:23
plain javascript port of dojo's uacss module
(function(){
var state = {};
var n = navigator,
ua = n.userAgent,
av = n.appVersion,
tv = parseFloat(av);
if(ua.indexOf("Opera") >= 0){state.isOpera = tv;}
state.isKhtml = (av.indexOf("Konqueror") >= 0) ? tv : 0;
@paulirish
paulirish / rAF.js
Last active June 11, 2024 14:29
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@jweir
jweir / flex-image.js
Created May 17, 2012 13:56
flex-image: javascript for image replacement based on screen size
(function(){
/*
flex-image: javascript for image replacement based on screen size
by John Weir http://famedriver.com
Usage, where `*` will be replaced by the image size.
<img data-src='/path-to-image/image-*.jpg' data-sizes='320:480,481:960' class='flex-image'/>
Thanks to Aurélien Delogu & Molt for the inspiration -> https://github.com/pyrsmk/molt
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 12, 2024 12:57
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@robwierzbowski
robwierzbowski / gitcreate.sh
Last active August 8, 2023 07:31
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class