Skip to content

Instantly share code, notes, and snippets.

@erainey
erainey / 0_reuse_code.js
Created May 5, 2014 14:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@erainey
erainey / jquery.equalizeCols.js
Created September 29, 2012 18:06
JavaScript: jQuery Equalize Columns
(function($){
/********EQUALIZE************/
$.fn.equalizeCols = function(){
var height = 0,
reset = $.browser.msie ? "1%" : "auto";
return this
.css("height", reset)
.each(function() {
@erainey
erainey / send_button_metrics.php
Created September 29, 2012 18:54
PHP: Facebook Send Button Metrics via Graph API
<?php
/***
Facebook Send Button Metrics via Graph API
Originally posted on Facebook Developer Blog by Zhen Fang.
Source: http://developers.facebook.com/blog/post/501
***/
$app_id = "YOUR_APP_ID";
@erainey
erainey / jquery.fb-social-plugins.js
Created September 29, 2012 18:52
JavaScript: Facebook Social Plugins jQuerified
(function($) {
$.fn.xfbmlParse = function() {
FB.XFBML.parse(document.getElementById(this));
return this
};
$.fn.fbActivityFeed = function(options) {
var activityFeedSettings = {site:window.location, width:"300", height:"300", header:true, colorscheme:"light", font:"arial", border_color:"", recommendations:false, filter:" ", ref:" "};
return this.each(function() {
if(options) {
$.extend(activityFeedSettings, options)
@erainey
erainey / facebook_comments_page_tab_setup.txt
Created October 9, 2012 17:04
Facebook Comments Social Plugin setup within Facebook (Fan) Page Tab
Facebook Comments setup within (Fan) Page Tab:
1) From https://developers.facebook.com/apps/{APP_ID} -> Edit Settings -> Basic
2) Setup "Website with Facebook Login -> Site URL" with same value as "Page Tab -> Page Tab URL"
3) Setup "App Domains" with domain of the above items
4) Make sure Open Graph Meta Tags are set up, for example:
<meta property="fb:app_id" content="{APP_ID}"/> (This allows moderation from the app admins, but should also be set up at http://developers.facebook.com/tools/comments?id={APP_ID}" -> Settings)
@erainey
erainey / index.html
Created January 12, 2013 18:19
JavaScript: jQuery UI Position Window Resize Demo
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Position Window Resize Demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
</head>
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@erainey
erainey / zip_arrays_to_hash.rb
Created March 25, 2013 16:20
Ruby: Two Arrays into Hash
a = ["title", "date"]
b = ["Hello world", "March 2013"]
c = Hash[a.zip(b)]
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@

Keybase proof

I hereby claim:

  • I am erainey on github.
  • I am erainey (https://keybase.io/erainey) on keybase.
  • I have a public key whose fingerprint is 0854 8B6D 5E01 B3E0 5BA2 98DF 537C 8B78 29B7 4155

To claim this, I am signing this object: