Skip to content

Instantly share code, notes, and snippets.

View CraigChilds94's full-sized avatar
🏠
Working from home

Craig Childs CraigChilds94

🏠
Working from home
View GitHub Profile
@CraigChilds94
CraigChilds94 / array_helpers.php
Last active March 1, 2016 16:42
Useful array functions.
<?php
/**
* Only get the values for keys which
* exist in the array.
*
* Example: array_only_keys(['a' => 'b', 'c' => 'd'], ['a']); // returns ['a' => 'b']
*
* @param Array $haystack The array you want values from
* @param Array|String $keys Array of keys, or a key which you want from the haystack
@CraigChilds94
CraigChilds94 / gist:4ef05074960c59c2bf3a
Created January 22, 2016 21:26 — forked from dsibilly/gist:2992412
Node.js clustered HTTP server example
(function () {
'use strict';
var cluster = require('cluster'),
http = require('http'),
os = require('os'),
/*
* ClusterServer object
@CraigChilds94
CraigChilds94 / retrieve.php
Created January 13, 2015 13:42
Handy function to parse a php file and store the result without outputting it.
<?php
/**
* Include a php file, and return the
* parsed content. Allows you to use php
* files instead of custom templating
* engines such as blade.
*
* Takes an array of data to pass to the included
* file and calls extract() on it.
@CraigChilds94
CraigChilds94 / _breakpoints.scss
Last active August 29, 2015 14:06
A nice way to do breakpoints in Sass
//
// Primary breakpoints
// ===================
// Define the projects breakpoints here. Some sensible defualts are included.
//
/**
* Less than
* =========
*