Skip to content

Instantly share code, notes, and snippets.

View nodesocket's full-sized avatar

Justin Keller nodesocket

View GitHub Profile
@nodesocket
nodesocket / gist:1479120
Created December 14, 2011 23:35
Logify Client
/**
* logify
*
* @todo
*
* @version 0.1.6
* @date last modified 11/19/2011
* @author NodeSocket <http://www.nodesocket.com> <hello@nodesocket.com>
* @copyright (c) 2011 NodeSocket. All Rights Reserved.
*/
@nodesocket
nodesocket / gist:1512463
Created December 23, 2011 00:21
MSMTP SETUP
//First get the msmtp package, via wget
#wget http://downloads.sourceforge.net/project/msmtp/msmtp/1.4.24/msmtp-1.4.24.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmsmtp%2F&ts=1313388097&use_mirror=superb-sea2
//Untar it
#tar -xjvf msmtp-1.4.24.tar.bz2
//Switch into the newly created msmtp-1.4.24 directory
#cd msmtp-1.4.24
//If you don't have a c compiler already, you'll need to install gcc
@nodesocket
nodesocket / gist:1536007
Created December 29, 2011 20:15
Mixpanel Gearman Worker
<?php
/**
* Insert MixPanel Event
*
* @todo
*
* @version 1.0.4
* @date last modified 11/13/2011
* @author NodeSocket <http://www.nodesocket.com> <hello@nodesocket.com>
* @copyright (c) 2011 NodeSocket. All Rights Reserved.
@nodesocket
nodesocket / gist:1536941
Created December 30, 2011 00:37
Supervisord Configuration
[supervisord]
logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=25MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=5 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
@nodesocket
nodesocket / gist:3102236
Created July 13, 2012 01:49
Textarea MaxLength Enforced
$(document).ready(function() {
$("textarea[maxlength]").bind("keyup input paste", function() {
var limit = parseInt($(this).attr('maxlength'));
var text = $(this).val();
var chars = text.length;
if(chars > limit){
var new_text = text.substr(0, limit);
$(this).val(new_text);
}
@nodesocket
nodesocket / v1.0.0
Created October 17, 2012 02:29
Rules Engine Documentation
Rules Engine
============
The NetDNA Rules Engine provides a powerful method of controlling how edge servers interact with your content and your websites visitors. One way to think of it is a powerful tool set that allows you to do everything a *.htaccess* allows you to do with Apache on the network of NetDNA edge servers.
One way to think of this is that you can use Rules Engine for the following categories of rules:
- ACLS (Access control lists) for permission
- Redirects
- Header manipulation
@nodesocket
nodesocket / gist:3903388
Created October 17, 2012 02:29
Rules Engine Documentation

Rules Engine

The NetDNA Rules Engine provides a powerful method of controlling how edge servers interact with your content and your websites visitors. One way to think of it is a powerful tool set that allows you to do everything a .htaccess allows you to do with Apache on the network of NetDNA edge servers.

One way to think of this is that you can use Rules Engine for the following categories of rules:

  • ACLS (Access control lists) for permission
  • Redirects
  • Header manipulation
@nodesocket
nodesocket / gist:3909074
Created October 17, 2012 23:53
Benchmark of for vs foreach in PHP
<?php
$elements = array();
////
// An array of 10,000 elements with random string values
////
for($i = 0; $i < 10000; $i++) {
$elements[] = (string)rand(10000000, 99999999);
}
@nodesocket
nodesocket / gist:3919205
Created October 19, 2012 16:33
All world timezones in an HTML select element
<select name="timezone_offset" id="timezone-offset" class="span5">
<option value="-12:00">(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11:00">(GMT -11:00) Midway Island, Samoa</option>
<option value="-10:00">(GMT -10:00) Hawaii</option>
<option value="-09:50">(GMT -9:30) Taiohae</option>
<option value="-09:00">(GMT -9:00) Alaska</option>
<option value="-08:00">(GMT -8:00) Pacific Time (US &amp; Canada)</option>
<option value="-07:00">(GMT -7:00) Mountain Time (US &amp; Canada)</option>
<option value="-06:00">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</option>
<option value="-05:00">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option>
@nodesocket
nodesocket / gist:3956163
Created October 25, 2012 23:38
NetNDA Rules Engine API Documentation

Rules Engine API Documentation

Get all rules for a given zone

Method: GET
/{alias}/zones/pull/{zone-id}/rules.{xml|json}

Example Request /netdna/zones/pull/14686/rules.json