Skip to content

Instantly share code, notes, and snippets.

View junkafarian's full-sized avatar

Fergus Doyle junkafarian

View GitHub Profile
// The expensive animation is causing performance issues. Write the function 'yourFunction' that reduces calls to the animation.
function scrollHandler() {
var items = document.querySelectorAll('.list-item');
var i = 0;
var len = items.length;
for(; i < len; i++) {
// perform expensive animation
}
/*
JavaScript Test
---------------
A small script to open a popup when clicking a link.
Once you click on the button, clinking on it again will close the popup.
*/
/* Task One - Improve this code
@junkafarian
junkafarian / cloud_setup.sh
Last active December 16, 2015 19:49
An example Fabric deployment task using gonzo helpers
$ gonzo config --cloud staging
$ gonzo launch staging-app
$ gonzo list
staging-app-001 m1.small ACTIVE junkafarian 0d 00h 05m 3s
@junkafarian
junkafarian / make_mysql_ramdisk
Last active October 12, 2015 14:08
make an in memory ramdisk with a mysql db installed for fast integration / functional tests
Then run the 2 mysql servers with:
/usr/local/bin/mysqld_multi start --tcp-ip 1,2
@junkafarian
junkafarian / redis_sessions.py
Created April 10, 2012 11:52
Redis session management using a dictionary-like API for session objects
import redis
from zope.interface import Interface, implements
try: #pragma NO COVERAGE
import simplejson as json
except ImportError: #pragma NO COVERAGE
import json
class RedisSession(dict):
""" Provides a lazy interface for presenting data stored in a redis DB as a
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
virtualenv_version = "1.4.3.post1"
import sys
import os
import optparse
import re
alias cleanflymake='find . -type f -name "*_flymake*" -exec rm -f {} \;'
alias cleanpyc='find . -type f -name "*.pyc" -exec rm -f {} \;'
class IProfileMetadata(Interface):
""" Provides contextual profile metadata
"""
title = Attribute(u'Profile title')
description = Attribute(u'Profile description')
biography = Attribute(u'Profile biography')
image = Attribute(u'Profile image')
url = Attribute(u'The url to the profile page')
dq = Attribute(u'The user\'s Design Quotient')