Skip to content

Instantly share code, notes, and snippets.

Tamlyn Rhodes tamlyn

View GitHub Profile
@dave1010
dave1010 / wp-cli.php
Created Apr 26, 2011
Load WordPress from a CLI not in the global scope
View wp-cli.php
<?php
// When loading WP from phpunit, phpunit doesn't run WP in the global scope.
// This breaks WP. This is an attempt to fix it.
function de_globalize_wp() {
// pretend this is apache
// I use $_SERVER['HTTP_HOST'] or a file called "host" to get the right DB settings
$_SERVER['HTTP_HOST'] = trim(file_get_contents(__DIR__ . '/host'));
@substack
substack / contributing.md
Created Mar 9, 2015
open open source boilerplate, adapted from levelup
View contributing.md

OPEN Open Source Project


What?

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

Rules

@jakebellacera
jakebellacera / css_time_to_milliseconds.js
Created Feb 27, 2014
CSS Time to Milliseconds - useful for timing functions around CSS animations
View css_time_to_milliseconds.js
/*
* CSS Time to Milliseconds
* by Jake Bellacera (http://jakebellacera.com)
* ============================================
*
* Converts CSS time into milliseconds. Useful for timing functions around CSS animations.
* It supports both seconds (s) and milliseconds (ms).
*
* Arguments:
* time_string - string representation of a CSS time unit (e.g. "1500ms" or "1.5s")
@webdesserts
webdesserts / Gulpfile.js
Last active Dec 24, 2019
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
View Gulpfile.js
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
@pwenzel
pwenzel / rbenv-fish-setup.md
Last active Mar 12, 2020
Installing rbenv in a fish environment
View rbenv-fish-setup.md

Here we use Homebrew to install rbenv:

  1. brew update; and brew install rbenv ruby-build
  2. Add ~/.rbenv/shims to your PATH
  3. Include the contents of completions/rbenv.fish in your Fish config.
  4. Run rbenv install 2.2.2 and rbenv rehash
  5. Run rbenv global 2.2.2

Now you can run gem install bundler and bundle install within your Ruby project.

@istepanov
istepanov / gist:3950977
Created Oct 25, 2012
Remove PHPStorm settings from Mac OS X 10.8 Mountain Lion
View gist:3950977
#!/usr/bin/sh
rm -rf "$HOME/Library/Preferences/WebIde40"
rm -rf "$HOME/Library/Caches/WebIde40"
rm -rf "$HOME/Library/Application Support/WebIde40"
rm -rf "$HOME/Library/Logs/WebIde40"
@samnang
samnang / gist:1759336
Created Feb 7, 2012
Install Bash version 4 on MacOS X
View gist:1759336
# Install Bash 4 using homebrew
brew install bash
# Or build it from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells
@fwielstra
fwielstra / api.js
Created Jun 14, 2011
An example NodeJS / Mongoose / Express application based on their respective tutorials
View api.js
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@lavoiesl
lavoiesl / assets_version.php
Created Oct 24, 2012
Automatic cache busting using Git commit in Symfony2
View assets_version.php
<?php
// app/config/assets_version.php
$container->loadFromExtension('framework', array(
'templating' => array(
'engines' => array('twig'),
'assets_version' => exec('git rev-parse --short HEAD'),
),
));
View transpile-esnext-modules.js
const MODULE_DIR = /(.*([\/\\]node_modules|\.\.)[\/\\](@[^\/\\]+[\/\\])?[^\/\\]+)([\/\\].*)?$/g;
{
loader: 'babel-loader',
test: /\.jsx?$/,
include(filepath) {
if (filepath.split(/[/\\]/).indexOf('node_modules')===-1) return true;
let pkg, manifest = path.resolve(filepath.replace(MODULE_DIR, '$1'), 'package.json');
try { pkg = JSON.parse(fs.readFileSync(manifest)); } catch (e) {}
return !!(pkg.module || pkg['jsnext:main']);
You can’t perform that action at this time.