Skip to content

Instantly share code, notes, and snippets.

View ethagnawl's full-sized avatar
🐢

Pete Doherty ethagnawl

🐢
View GitHub Profile
@ethagnawl
ethagnawl / database.rake
Created March 31, 2016 17:59 — forked from jmccartie/database.rake
Copy Heroku production DB to local database
namespace :db do
desc "Copy production database to local"
task :copy_production => :environment do
###
# HEROKU
###
# Download latest dump
@ethagnawl
ethagnawl / elm-package.json
Created March 11, 2016 22:19 — forked from danyx23/elm-package.json
Simple example of using Ports in Elm
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
@ethagnawl
ethagnawl / CustomStartApp.elm
Created March 11, 2016 21:53 — forked from danyx23/CustomStartApp.elm
Use ports with customized StartApp and "PortActions"
module CustomStartApp (start, App, Config) where
import Html exposing (Html)
import Effects exposing (Effects, Never)
import Task
type alias Config model action portAction =
{ init : ( model, Effects action, portAction )
, update : action -> model -> ( model, Effects action, Maybe portAction )
@ethagnawl
ethagnawl / CSS
Last active August 29, 2015 14:22 — forked from hugeuser/CSS
#projects {
height:100%;
}
.slide {
position: absolute;
top:0;
left:0;
height: 0;
width: 100%;
@ethagnawl
ethagnawl / JavaScript
Last active August 29, 2015 14:22 — forked from hugeuser/JavaScript
var delta;
var currentSlideIndex = 0;
function elementScroll (e) {
// --- Scrolling up ---
if (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0) {
delta--;
@ethagnawl
ethagnawl / Mobile
Last active August 29, 2015 14:22 — forked from hugeuser/Mobile
var delta;
dragThreshold = 0.15;// "percentage" to drag before engaging
dragStart = null; // used to determine touch / drag distance
percentage = 0,
target,
previousTarget;
function touchStart(event) {
if (dragStart !== null) { return; }
$(document).ready(function(){
countdown();
setInterval(countdown, 1000);
function countdown () {
var now = moment(), // get the current moment
// May 28, 2013 @ 12:00AM
then = moment([2013, 4, 28]),
// get the difference from now to then in ms
ms = then.diff(now, 'milliseconds', true);
// If you need years, uncomment this line and make sure you add it to the concatonated phrase
var times = {
Schedule: {
"2014-09-26T00:00:00": [1,23],
"2014-09-27T00:00:00": [9,14]
}
};
function formatHour(hour) {
return hour > 12 ?
/*
* Set up factories, then create them in tests with (for example):
*
* LineItemFactory();
*
* Or with attributes / overrides:
*
* LineItemFactory({
* "id": 123,
* "order": OrderFactory({"firstName": "Example Associated Record Override"}),
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#