Skip to content

Instantly share code, notes, and snippets.

View metaskills's full-sized avatar
🐙
Being Inkcellent to Each Other

Ken Collins metaskills

🐙
Being Inkcellent to Each Other
View GitHub Profile
(function($){
function dragEnter(e) {
$(e.target).addClass("dragOver");
e.stopPropagation();
e.preventDefault();
return false;
};
function dragOver(e) {
e.originalEvent.dataTransfer.dropEffect = "copy";
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@wycats
wycats / 0_app.rb
Created April 19, 2012 10:22
Example of using a simple future library for parallel HTTP requests
class TicketsController < ApplicationController
def show
tickets = params[:tickets].split(",")
ticket_data = tickets.map do |ticket|
parallel { Faraday.get("http://tickets.local/#{ticket}") }
end
render json: { tickets: ticket_data.map(&:result) }
end
@asmallteapot
asmallteapot / gist:2368038
Created April 12, 2012 15:14
Notes from @UncleBobMartin’s Demanding Professionalism talk in Tampa, Florida on 11 April 2012.

Demanding software professionalism

Presented by Bob Martin in Tampa, Florida on 11 April 2012.

Miscellany

“Uranus is not a naked–eye object under any circumstances.”

  • Copernicus’ motivation was religious, not scientific! Galileo looked at the phases of Venus to determine its orbit in relation to Sol.

Bob: How do you become unafraid of your code?

@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@chriseppstein
chriseppstein / 0_usage.scss
Created February 29, 2012 19:29
This is code that runs using Sass 3.2 prerelease and something like this will be in compass soon.
@include keyframes(appear-and-roundify) {
0% { opacity: 0; @include border-radius(2px); }
100% { opacity: 1; @include border-radius(10px); }
}
@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@samography
samography / shorten-url.rb
Created January 24, 2012 06:18
Quick and dirty Ruby script to shorten URLs via command line using Bitly
# Requires the bitly gem
# gem install bitly
require 'rubygems'
require 'bitly'
# Force gem to use latest bitly API version
Bitly.use_api_version_3
# Requires bitly.com account and API key (http://bitly.com/a/account)