Skip to content

Instantly share code, notes, and snippets.

View colynb's full-sized avatar
🎯
Focusing

C Brown colynb

🎯
Focusing
View GitHub Profile
@colynb
colynb / mongo_install.bash
Last active August 29, 2015 14:03
MongoDB install on Ubuntu
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen.list
apt-get -y update
apt-get -y --force-yes install mongodb-10gen
@colynb
colynb / index.html
Last active August 29, 2015 14:06 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style id="jsbin-css">
.js-banner {
padding: 40px;
background: #a4b357;
@colynb
colynb / gist:09734bcef5b32455abae
Last active August 29, 2015 14:12
Install PHP on OSX

There are many ways to get the latest PHP version running on your mac, but so far the one that seemed the least complicated is to use phpbrew

Start here: https://github.com/phpbrew/phpbrew

From there, there are instructions for getting PHP installed. It's also used as a version switcher, which can be useful for managing multiple projects with different version requirements.

I noticed, the build failed because of a missing component called "libmcrypt". To fix that I just installed that with homebrew:

@colynb
colynb / dabblet.css
Created December 22, 2011 03:30 — forked from chriscoyier/dabblet.css
Checkbox Hack
/* Checkbox Hack */
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
-webkit-appearance: push-button;
-moz-appearance: button;
@colynb
colynb / gist:3290105
Created August 7, 2012 22:36
Native Array foreach implementation
Array.prototype.foreach = function(action) {
for (var i = 0; i < this.length; i++) {
action(i, this[i]);
}
};
​var arr = [1,2,3,4];
arr.foreach(function(i,item){
$('#log').append('<p>'+item+'</p>');
@colynb
colynb / gist:3290235
Created August 7, 2012 22:48
Array prototypes
/*
* Foreach
* Example:
* var arr = [1,2,3,4];
* arr.foreach(function(i,item) {
* console.log(i, item);
* });
*
*/
Array.prototype.foreach = function(action) {
@colynb
colynb / gist:3383209
Created August 17, 2012 22:14
TIPS: Clear Chrome DNS Cache
chrome://net-internals/#dns
Just a quick tip for those who need to clear Chrome's DNS cache only. The method for "Empty the cache" under "Clear Browsing Data" clear both files caches and DNS caches.
To just clear the DNS cache, type this into the browser: chrome://net-internals/#dns
@colynb
colynb / gist:3390791
Created August 19, 2012 01:27
JS: Wrap Terms With...
/*
* Take a string and wrap any terms with some container (like <span>)
* Nothing complicated. It splits a string on ',' (comma) and 'and', and adds the desired wrapper around the resulting terms.
*/
​var str = 'Web Developer and Front-End Engineer and All around cool guy';
String.prototype.wrapTermsWith = function(wrap) {
var delimiters = [',', ' and '],
wrapper = wrap.split('><'),
@colynb
colynb / gist:3430759
Created August 23, 2012 00:07
JavaScript: Namespacing Native Object Prototypes
/*
* Where I work, I thought it would come in handy to have a
* collection of methods that I could apply to native JS
* objects, like strings.
*
* While it would be useful to do this:
*/
String.prototype.touch = function() {
return this + ' has been touched';
@colynb
colynb / dabblet.css
Created August 28, 2012 22:28
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;