Skip to content

Instantly share code, notes, and snippets.

View edorgeville's full-sized avatar
:octocat:
🧲

Erwan d'Orgeville edorgeville

:octocat:
🧲
View GitHub Profile
☻ (。╹ω╹。)
☻ ლ(╹◡╹ლ)
☻ (●´⌓`●)
☻ ([∂]ω[∂])
☻ <犬>
☻ U^エ^U
☻ <泣>
☻ (〒ó〒)
☻ (T^T)
☻ (íoì)
@chrishulbert
chrishulbert / ssdp.node.js
Created March 30, 2011 21:46
Service discovery using node.js and ssdp / universal plug n play
var dgram = require('dgram'); // dgram is UDP
// Listen for responses
function listen(port) {
var server = dgram.createSocket("udp4");
server.on("message", function (msg, rinfo) {
console.log("server got: " + msg + " from " + rinfo.address + ":" + rinfo.port);
});
@watson
watson / ability.rb
Created October 5, 2011 09:50
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@tbeseda
tbeseda / wobble.css
Created February 8, 2012 00:12
slowly wobble an element with CSS -- shamelessly ripped from love.travis-ci
/* just webkit, 'cause yeah... */
@-webkit-keyframes wobble {
0% { -webkit-transform: rotate(0deg); }
20% { -webkit-transform: rotate(2deg); }
50% { -webkit-transform: rotate(-2deg); }
100% { -webkit-transform: rotate(0deg); }
}
.wobble { -webkit-animation: wobble 5s infinite; }

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 28, 2024 20:15
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ashirazi
ashirazi / .irbrc
Created July 19, 2012 18:54
pry instead of irb (everywhere including 'bundle console', 'rails console', 'irb')
# put this in your ~/.irbrc
begin
require 'pry'
Pry.start
exit
rescue LoadError
puts "Pry not found, using 'irb' instead. Try\n gem install pry"
end
@paulsturgess
paulsturgess / reset_primary_key.md
Created February 27, 2013 19:49
Reset postgres primary key index using Rails
$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')

If you need the table names:

$ ActiveRecord::Base.connection.tables

=> ["accounts", "assets", ...]