Skip to content

Instantly share code, notes, and snippets.

Tamlyn Rhodes tamlyn

Block or report user

Report or block tamlyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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'));
@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'),
),
));
@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

@sevcsik
sevcsik / nodejs-angularjs-common-modules.md
Last active Mar 8, 2018
Sharing modules between NodeJS and AngularJS
View nodejs-angularjs-common-modules.md

They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).

Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.

Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.

No globals in the front-end, and dependencies will work. The isNode and isAngular va

@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")
@richardscarrott
richardscarrott / !react-enzyme-render-methods.md
Last active Aug 13, 2018
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods
View !react-enzyme-render-methods.md

An exploration of the different render methods available in react-enzyme.

@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"
@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');
@ceejbot
ceejbot / esm_in_node_proposal.md
Last active Jul 17, 2019
npm's proposal for supporting ES modules in node
View esm_in_node_proposal.md

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

@Rarst
Rarst / deprecated.md
Last active Jul 29, 2019
WordPress coding standards configuration for PhpStorm
View deprecated.md

Now Native

PhpStorm now bundles WordPress coding style natively, starting from version 8.

  1. Go to Project Settings > Code Style > PHP.
  2. Select Set From... (top right of window) > Predefined Style > WordPress.

No longer need to muck with this import! :)

You can’t perform that action at this time.