Skip to content

Instantly share code, notes, and snippets.

View nfreear's full-sized avatar

Nick Freear nfreear

View GitHub Profile
@scribu
scribu / router.php
Created November 16, 2012 15:32 — forked from tamagokun/router.php
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'],'/' );
if ( file_exists( $root.$path ) )
{
if ( is_dir( $root.$path ) && substr( $path,strlen( $path ) - 1, 1 ) !== '/' )
{
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@svallory
svallory / font-awesome-mixins.less
Created August 30, 2012 04:04
FonAwesome Icons using Mixins instead of classes (Please see the first comment)
/* Font Awesome
the iconic font designed for use with Twitter Bootstrap
-------------------------------------------------------
The full suite of pictographic icons, examples, and documentation
can be found at: http://fortawesome.github.com/Font-Awesome/
License
-------------------------------------------------------
The Font Awesome webfont, CSS, and LESS files are licensed under CC BY 3.0:
http://creativecommons.org/licenses/by/3.0/ A mention of
@tansengming
tansengming / .gitconfig
Last active October 7, 2015 10:17
Default gitconfig
[user]
name = SengMing Tan
email = [email protected]
[alias]
b = branch
c = commit .
co = checkout
stat = status
s = status
h = log --pretty=format:'%Cblue%h %Cgreen %ar%Creset %s'
@maxparm
maxparm / .htaccess
Created July 13, 2012 15:37
.htaccess with appropriate CORS header
<IfModule mod_rewrite.c>
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header add Access-Control-Allow-Headers: "Content-Type"
RewriteEngine on
RewriteBase /
</IfModule>
@mathiasverraes
mathiasverraes / phplint.sh
Created July 12, 2012 07:42
Recursive PHP Lint script
#!/bin/bash
for file in `find .`
do
EXTENSION="${file##*.}"
if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ]
then
RESULTS=`php -l $file`
@asabaylus
asabaylus / gist:3071099
Created July 8, 2012 14:12
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@negrond
negrond / MinneBar 7: What We Don't Know Links
Created June 30, 2012 13:21
MinneBar 7: What We Don't Know Links
@nfreear
nfreear / .gitconfig--.npmrc
Last active May 1, 2020 05:27
Per-user ~/.gitconfig and per-REPO/.git/config on OU servers (hence smart HTTPS protocol) — plus .npmrc
# See: http://draconianoverlord.com/2010/03/04/git-config.html
# See: https://github.com/rtomayko/git-sh
# See: https://gist.github.com/502434
# REPO/.git/config
[remote "origin"]
# Generic by default.
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://[email protected]/IET-OU/pd-open-ac-uk.git
@dbu
dbu / git-status-recursive
Created May 31, 2012 14:14
recursive git status
#!/usr/bin/php
<?php
$repos = array();
exec('find -type d -name .git | sed -e "s/\.git//"', $repos);
foreach ($repos as $repo) {
$status = shell_exec("cd $repo && git status");
if (false == strpos($status, 'nothing to commit (working directory clean)')) {
echo "$repo\n" . str_repeat('-', strlen($repo)) . "\n$status\n\n";
}
}