Skip to content

Instantly share code, notes, and snippets.

@tamagokun
tamagokun / router.php
Last active March 12, 2020 11:15
Run a Wordpress site via PHP's built-in web server
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
set_include_path(get_include_path().':'.__DIR__);
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';
@manarth
manarth / drupal killer contract.md
Created January 8, 2013 19:42
Drupal contract, based on Andy Clarke's Killer Contract: https://gist.github.com/4031343

Technical Consultancy Contract

Between us [company name] and you [customer name]

Summary

Consulting Contract

Revised date: 01/22/2013

Between us McGintech and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so

@EmilStenstrom
EmilStenstrom / runserver.py
Last active December 12, 2015 10:49
Automatically watch Sass and CoffeeScript files when runserver command is run... Put this in /<your app>/management/commands/runserver.py
import atexit
import subprocess
from django.core.management.commands.runserver import BaseRunserverCommand
from django.core.servers.basehttp import AdminMediaHandler
from django.conf import settings
# Patch runserver to run the sass and coffeesscript compilers automatically
class Command(BaseRunserverCommand):
active_processes = []
@aortbals
aortbals / dispatch.py
Last active October 20, 2023 16:09
Synchronize two folders using python.
#! /usr/bin/python
# Dispatch - synchronize two folders
import os
import filecmp
import shutil
from stat import *
class Dispatch:
''' This class represents a synchronization object '''
@simshanith
simshanith / windowScroll.js
Last active December 15, 2015 06:19
Progressively enhanced cross-browser scrolling, via Modernizr, jQuery Transit, and classic $.scrollTo fallback
var sliding = false; // variable outside function scope to detect a slide is in progress
function slideTo(target, duration){ // credit to Mahieddine Abdelkader & Ludwig Wendzich for original ideas.
var to = isNaN(target) ? $(target).offset().top : target, //find scroll to position
from = $(window).scrollTop() //find starting point
dy = to-from, //calculate change in scroll position - deltaY
body = $("body"), // TODO: better to have it outside of local scope already rather than fetching it every time...
duration = isNaN(duration) ? 500 : duration;
// We're going to use translate-y to move the the page so it feels like we're at the *from* scroll position, when we're actually instantly at the *to* scroll position. */
@jpawlowski
jpawlowski / brew-sync.sh
Last active September 26, 2023 19:54
Sync Homebrew installations between Macs via Dropbox
#!/bin/bash
# Sync Homebrew installations between Macs via Dropbox
#
BREW="/usr/local/bin/brew"
# first get local settings
echo "Reading local settings ..."
rm -f /tmp/brew-sync.*

Development Contract Killer

A fork of the popular open-source contract for web designers and developers by Stuff & Nonsense, reworded for developers


Between us [company name] and you [customer name]

@gavinhungry
gavinhungry / nginx-tls.conf
Last active March 7, 2025 19:38
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <[email protected]>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@neil-h
neil-h / _bootstrap-em.scss
Last active November 17, 2017 16:12 — forked from jasny/bootstrap-em.less
A Sass port of jasny/bootstrap-em.less
@function strip-units($number) {// From : http://stackoverflow.com/a/12335841/1339426
@return $number / ($number * 0 + 1);
}
/**
* Use em or rem font-size in Bootstrap 3
* Ported from Less version here: https://gist.github.com/jasny/9731895
*/
$font-size-root: 18px;
$font-unit: 1rem; // Pick em or rem here