Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@olorton
olorton / provision
Created May 19, 2014 13:39
Anisble provision script
#!/bin/bash
while getopts "v:" OPTION; do
case $OPTION in
v) shift; verbose=true;;
# Unknown option. No need for an error, getopts informs
# the user itself.
\?) exit 1;;
esac
done
@booleanbetrayal
booleanbetrayal / Gruntfile.js
Last active November 9, 2023 18:59
Example GruntJS configuration for a replacement to the Sprockets Rails asset pipeline
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var paths = {
@branneman
branneman / better-nodejs-require-paths.md
Last active April 8, 2024 00:22
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@olexpono
olexpono / Custom.css
Last active February 14, 2023 15:44
Crate -- a Dark gray/orange Theme for Chrome DevTools
/**********************************************/
/*
/*
/* Crate -- Theme for Chrome DevTools
/* Last Update :: September 2013
/*
/* based on:
/* mnml by Michael P. Pfeiffer
/* Based on a Gist by Ben Truyman. Further attr:
/* https://gist.github.com/3040634
@elucas
elucas / gist:5056751
Last active December 14, 2015 08:19
This is the Ajax form submission -> content update code that reaffirmed my Man-Crush on Ben.

When you submit the form#filters_form, it requests the response in the background, replaces the existing contents of #article_blocks with the #article_blocks from the response, and updates the url with the params given.

Oh, and if it fails, it redirects you to the form url, so that you're not left in a broken ajax state.

So:

  • No fancy ajax logic server-side
  • No fancy ajax logic client-side
  • Just the bit of content you wanted gets updated

Disclaimer: Tweaks would be needed for POST forms

@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@schinckel
schinckel / jquery.couch.longpoll.js
Created January 22, 2012 11:29
Long-polling handler for CouchDB
/*
# jquery.couch.longpoll.js #
A handler that can be used to listen to changes from a CouchDB database,
using long-polling.
This seemed to be a bit simpler than using continuous polling, which I
was unable to get working with jQuery.
@benfoxall
benfoxall / instructions.md
Created May 20, 2011 09:46
apache vhosts
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@fdmanana
fdmanana / gist:832610
Created February 17, 2011 20:27
The CouchDB replicator database

1. Introduction to the replicator database

A database where you PUT/POST documents to trigger replications and you DELETE to cancel ongoing replications. These documents have exactly the same content as the JSON objects we used to POST to /_replicate/ (fields "source", "target", "create_target", "continuous", "doc_ids", "filter", "query_params".

Replication documents can have a user defined "_id". Design documents (and _local documents) added to the replicator database are ignored.

The default name of this database is _replicator. The name can be changed in the .ini configuration, section [replicator], parameter db.

2. Basics