Skip to content

Instantly share code, notes, and snippets.

View arsduo's full-sized avatar

Alex Koppel arsduo

View GitHub Profile
@arsduo
arsduo / gist:988553
Created May 24, 2011 11:20
jQuery Mobile - page enhancement on demand
/*
* jQuery Mobile Framework : "page" plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function($, undefined ) {
$.widget( "mobile.page", $.mobile.widget, {
// other code
@arsduo
arsduo / gist:997914
Created May 29, 2011 16:25
Euruko demo code (Koala & Facebook)
# demo from Euruko lightning talk 2011
# links:
# * http://github.com/arsduo/koala (code/wiki documentation)
# * http://oauth.twoalex.com (easy access tokens)
# * http://developers.facebook.com/docs/coreconcepts/ (FB docs)
# the person I hang out with most
people = g.fql_query("select tagged_uids from checkin where author_uid = me()")
bestfriend = people.collect {|c| c["tagged_uids"]}.flatten.group_by {|u| u}.values.max_by(&:length).first
Koala::Facebook::GraphAPI.batch do
@arsduo
arsduo / gist:1002086
Created June 1, 2011 10:28
Getting Rack::Offline to work in uncached mode
require "rack/offline/config"
require "rack/offline/version"
require "digest/sha2"
require "logger"
require "pathname"
require 'uri'
module Rack
class Offline
def self.configure(*args, &block)
@arsduo
arsduo / gist:1698259
Created January 29, 2012 10:52
Culture!
1.9.2p290 :007 > Mongoid::Document.send(:include, ActiveModel::SerializerSupport)
=> Mongoid::Document
1.9.2p290 :008 > Mongoid::Document.include?(ActiveModel::SerializerSupport)
=> false
1.9.2p290 :009 > Mongoid::Document.included_modules
=> [ProprietaryModule]
1.9.2p290 :014 > Mongoid::Document.ancestors
=> [Mongoid::Document, ProprietaryModule]
@arsduo
arsduo / speaker.md
Created June 25, 2012 18:38 — forked from matiaskorhonen/speaker.md
Sleep! Talk Proposal for Frozen Rails
@arsduo
arsduo / batch_controller.rb
Created August 7, 2012 16:15
A proposal for a RESTful Batch API
class BatchController < ApplicationController
# Public: a proposal for a batch request endpoint implementation in Rails, inspired
# by Facebook's Batch API (http://developers.facebook.com/docs/reference/api/batch/).
# If this makes sense technically, a Rails engine gem will be forthcoming :)
#
# Batch requests take the form of a series of REST API requests,
# each containing the following arguments:
# url - the API endpoint to hit, formatted exactly as you would for a
# regular REST API request (e.g. leading /, etc.)
# method - what type of request to make -- GET, POST, PUT, etc.
@arsduo
arsduo / gist:3447740
Created August 24, 2012 08:53
Fantasy Film Fest
@arsduo
arsduo / gist:4524368
Created January 13, 2013 14:33
Fun with MacRuby
irb(main):004:0> Module.new do
irb(main):005:1> define_method :foo do
irb(main):006:2> 2
irb(main):007:1> end
irb(main):008:0> end
ArgumentError: wrong number of arguments (1 for 0)
irb(main):009:0> Module.new do
irb(main):010:1> define_method do
irb(main):011:2> 2
@arsduo
arsduo / gist:6799481
Created October 2, 2013 19:46
Elasticsearch log output
[2013-10-02 19:42:10,547][INFO ][node ] [logging] version[0.90.3], pid[488], build[5c38d60/2013-08-06T13:18:31Z]
[2013-10-02 19:42:10,547][INFO ][node ] [logging] initializing ...
[2013-10-02 19:42:10,554][INFO ][plugins ] [logging] loaded [], sites []
[2013-10-02 19:42:12,768][INFO ][node ] [logging] initialized
[2013-10-02 19:42:12,769][INFO ][node ] [logging] starting ...
[2013-10-02 19:42:12,940][INFO ][transport ] [logging] bound_address {inet[/0.0.0.0:9301]}, publish_address {inet[/10.0.2.15:9301]}
[2013-10-02 19:42:15,984][INFO ][cluster.service ] [logging] new_master [logging][mDAjSgUFQ-G34_EA4I4dmw][inet[/10.0.2.15:9301]]{max_local_storage_nodes=1}, reason: zen-disco-join (elected_as_master)
[2013-10-02 19:42:15,998][INFO ][discovery ] [logging] elasticsearch/mDAjSgUFQ-G34_EA4I4dmw
[2013-10-02 19:42:16,019][INFO ][node ] [logging] stopping ...
[20