Skip to content

Instantly share code, notes, and snippets.

View EtienneLem's full-sized avatar

Etienne Lemay EtienneLem

View GitHub Profile
@EtienneLem
EtienneLem / random_rdio_track.rb
Created March 4, 2014 02:17
Random Rdio Track
# Rdio console: http://rdioconsole.appspot.com
# Get a track: http://rdioconsole.appspot.com/#keys%3Dt[INSERT 7 DIGITS NUMBER HERE]%26method%3Dget
def get_random_number
1_000_000 + Random.rand(10_000_000 - 1_000_000)
end
track_key = get_random_number
puts track_key
@EtienneLem
EtienneLem / .zshrc
Created April 2, 2014 15:05
Rename Terminal tab
tabname() { printf "\e]1;$1\a" }
@EtienneLem
EtienneLem / react-dom.js
Created May 6, 2014 13:50
A JavaScript example
Hello = React.createClass({
componentWillMount: function() { console.log('componentWillMount') },
componentDidMount: function() { console.log('componentDidMount') },
render: function() {
return DOM.div({ class: 'container' }, [
DOM.span({
data: {
foo: { bar: 'baz' },
much: { much: 'fun' },
# GIFme
# This is a really simple/stupid command line (specifically zsh) function to copy public Dropbox links to your gifs.
#
# Put this somewhere in your .zshrc and replace {{YOUR_PUBLIC_ID}} with your public Dropbox ID (find this by going to dropbox.com, finding a file in your "Public" folder, selecting it and clicking "Copy public link", and looking for the long number in the URL)
#
# This assumes your gifs (and other images you want to share) are stored in your Dropbox "Public" folder in a directory called "gifs".
# This whole thing ain't pretty, and it could be much better. But it's a start.
#
# Usage:
# "$ gifme yup.gif" will copy a public link to "{{Dropbox Directory}}/Public/gifs/yup.gif"
@EtienneLem
EtienneLem / _utils.scss
Created September 16, 2011 13:24
Scss utils.
// Scss Utils
// @author EtienneLem
// CSS3 misc
@mixin rounded ( $radius, $prefix:'' ) {
@include prefixes(border-radius, $radius, $prefix);
}
@mixin box-shadow ( $value ) {
@include prefixes(box-shadow, $value);
@EtienneLem
EtienneLem / Compile CoffeeScript to JS.tmCommand
Created March 7, 2012 15:43
Compile CoffeeScript to JS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>#!/usr/bin/env ruby
# encoding: utf-8
@EtienneLem
EtienneLem / cookie.rb
Created March 8, 2012 18:56
Cookie expiration date [Ruby]
@EtienneLem
EtienneLem / BrowserDetect.coffee
Created April 5, 2012 18:39
BrowserDetect (Coffeescript)
# Original BrowserDetect.js: @Teevio (http://teev.io/blog/text/13423292)
# Original idea: @rogie (http://rog.ie/post/9089341529/html5boilerplatejs)
# CoffeeScript implementation: @EtienneLem
class BrowserDetect
@init: ->
browser = @searchString(@dataBrowser) || "An unknown browser"
version = @searchVersion(navigator.userAgent) || @searchVersion(navigator.appVersion) || "An unknown version"
os = @searchString(@dataOS) || "An unknown OS"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>#!/usr/bin/env ruby
# encoding: utf-8
@EtienneLem
EtienneLem / gist:4032653
Created November 7, 2012 16:33 — forked from daneden/gist:4032573
Sass media queries and @extend
// Fairly safe way to visually hide content, but make it accessible to screen readers
.visually-hidden {
position: absolute;
left: -9999px;
height: 1px;
}
@media screen and (max-width: 700px) {
// Again, accessible to screen readers
// Example: <a href="/login" class="icon icon-twitter"><span class="mobile-offscreen">Single-click </span> log in with Twitter</a>