Skip to content

Instantly share code, notes, and snippets.

# My attempt at generalizing a common feature among C&T sites.
class Transporter
scroll = if 'ontouchmove' of window then 'ontouchmove' else 'scroll'
scroll = 'scroll'
history.pushState ?= -> null
$window = $(window)
$document = $(document)
LOADER_HEIGHT = null
constructor: ({@content, @footer, @paths, @onPageLoad, @onPageChange}) ->
@knubie
knubie / gist:980597d2a14251099786
Last active August 29, 2015 14:11
Node vs Ruby Selenium testing

Node vs Ruby Selenium testing


Tools:
  Ruby:
    - Rspec - Test runner
    - Capybara - browser control bindings / assertion library
    - Selenium - browser abstraction and running factory
  Node:
    - Mocha - Test runner
@knubie
knubie / post-receive
Created October 29, 2014 20:56
franchise post-receive
#!/bin/bash
# mkdir ~/franchise
# mkdir ~/franchise-deploy
# ~/franchise/hooks/post-receive
GIT_WORK_TREE=$(pwd)/../franchise-deploy git checkout -f master
cd $(pwd)/../franchise-deploy
gulp sass && gulp jade && gulp coffee
# Credit: http://richardconroy.blogspot.com/2010/08/capybara-reference.html
#Navigating
visit('/projects')
#Clicking links and buttons
click_link('id-of-link') # e.g. <a href="google.com" id="id-of-link">click me</a>
click_link('Link Text') # e.g. <a href="google.com">Link Text</a>
click_button('Save')
click('Link Text') # Click either a link or a button
@knubie
knubie / lapis1.md
Last active August 29, 2015 14:07
Implementing Oauth with Lapis (Lua OpenResty, Nginx, Postgres) and Docker

Implementing OAuth with Lapis (Lua, OpenResty, Nginx, Postgres) and Docker

Part 1 – Setting up docker with fig

Install docker

https://docs.docker.com/installation/

On OS X you can use Boot2Docker, or use Vagrant to spin up an empty Ubuntu machine (or whatever OS your production environment will run on).

layout:
hero:
title: eye **studio** brow
subtitle: lorem ipsum
background: background.jpg
modules: (modules identified by their "nav name")
- tutorials
- trends
- brow 101
- ...

Installing Lapis

Installing Openresty

Add the homebrew/nginx tap.

$ brew tap homebrew/nginx

Install openresty from homebrew.

Instructions for new locale-specific additions.

Locale users can activate/deactivate vodkas for their locale.

- Got to vodkas on the main navigation.
- Click on the blue edit button next to the vodka you want to edit.
- Scroll to the bottom and change the "Activated for Locale" option to activate/deactivate.

--

Locale users can activate/deactivate cocktails for their locale.

@knubie
knubie / gist:5227b77846bc260da79b
Last active August 29, 2015 14:04
Partial application
# Without partial application.
ajax.get('url', (data) ->
map data, (item) ->
replace item, /_/g, '-'
# With partial application.
ajax.get('url', map(replace(/_/, '-')))
#========================================
joinToPrev : ->
prev = messages.findOne
createdAt:
$gt: @createdAt
prev.from is @from and not a prev.mention