Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am eoy on github.
  • I am eoy (https://keybase.io/eoy) on keybase.
  • I have a public key ASCI5tQ_5TM2p4HIx2zRDSSs1UQykg6AOUrhtLDd6WRaWgo

To claim this, I am signing this object:

# http://stackoverflow.com/a/8936202
#
# ActiveAdmin already includes the necessary jquery in active_admin/base,
# so just add this to javascripts/active_admin.js after //= require active_admin/base
#
#
# Serialize and Sort
#
# model_name - you guessed it, the name of the model we are calling sort on.
# This is the actual variable name, no need to change it.
require 'dalli/client'
require 'yaml'
class GeocoderDalliClient
def initialize
@keys = 'GeocoderDalliClientKeys'
# setup for Heroku using the memcachier gem.
# On other setups you'll have to specify the Memcached server
@dalli_client = Dalli::Client.new
end
@eoy
eoy / explanation.md
Last active December 22, 2015 16:29
Manaflask competition comments explanation
  1. User sees article without the question
  2. User clicks pagination or posts a comment
  3. Comments are refreshed showing the latest comments (old comments + all new since you posted)
  4. User still sees article without the question
  5. User now navigates to page 5 and sees someone answered the question while the article (to him) doesn't contain the question
  6. User rages!
  7. User takes screenshot of Hans saying he will post at 18:30, Hans posted at ~18:29:20

Comments are refreshed every time you post a comment or click a page in the navigation, without refreshing the rest of the article. This is what happened. If someone would be cheating we'd be sure to catch them.

@eoy
eoy / gist:5363019
Created April 11, 2013 12:32
PhantomJS for TodoMVC Test #2
const PHANTOM_FUNCTION_PREFIX = '/* PHANTOM_FUNCTION */';
var page = require('webpage').create(),
system = require('system'),
t,
address,
url = system.args[1],
t = Date.now(),
length;
page.onInitialized = function() {
@eoy
eoy / gist:5356255
Last active December 16, 2015 01:39
PhantomJS for TodoMVC
const PHANTOM_FUNCTION_PREFIX = '/* PHANTOM_FUNCTION */';
var page = require('webpage').create(),
system = require('system'),
t,
address,
url = system.args[1],
t = Date.now(),
length;
page.onInitialized = function() {
  1. Install GCC Compiler or XCode

Options (choose one)

  1. Install Homebrew (package manager)

In shell:

@eoy
eoy / deploy.rb
Created July 20, 2012 22:49
Eoy's Server/Deploy Setup
require "bundler/capistrano"
set :whenever_command, "bundle exec whenever"
require 'whenever/capistrano'
server "123.456.789.10", :web, :app, :db, primary: true
set :application, "app_name"
set :user, "deployer"