This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// format an array into columns as sub arrays | |
var splitter = function (columns, data) { | |
try { | |
var out = [], col = []; | |
var colSize = Math.ceil(data.length / columns); | |
var count = 0; | |
for (key in data) { | |
if (count > colSize) { | |
out.push(col); | |
col = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// just a test to see if compressing url-encoded json looks/works any better | |
var strofa = require("strofa"); | |
cl = function(obj) { console.dir(obj, {depth: null, colors: true}); }; | |
var string = '{"subjectonly_keyword":["ACCTG 713"]}'; | |
cl(string); | |
cl(encodeURIComponent(string)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extend = require(extend); | |
/* Creates an array of items representing the pagination navigation. | |
You can then pass this to your template engine eg handlebars | |
Also see the PHP version: | |
https://gist.github.com/robmint/e4b037aba1687195524c | |
Based on the work of Jason Coleman | |
http://www.strangerstudios.com/blog/2006/07/paginate-your-site-like-digg/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// based on the work of Jason Coleman | |
// http://www.strangerstudios.com/blog/2006/07/paginate-your-site-like-digg/ | |
/* The pagination function simply spits out a data structure | |
that you can render any way you like. | |
See also the javascript version for node: | |
https://gist.github.com/robmint/4651cf1c6f336e663dba | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// works well with querystring.stringify to produce GET parameters | |
function objectArrayPush(data, key, value) { | |
if (typeof data[key] != 'undefined' && data[key] instanceof Array) { | |
// EXISTS: pushing onto list | |
data[key].push(value); | |
} else { | |
// CREATING: pushing onto list | |
data[key] = []; | |
data[key].push(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = { | |
subject: ['Medical Science', 'Philosophy'], | |
year: ['2015', '2013'] | |
}; | |
for (key in data) { | |
if (data.hasOwnProperty(key) && data[key] instanceof Array) { | |
list = data[key]; | |
list.forEach(function (value) { | |
console.log(key + " : " + value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <fcntl.h> | |
#include <linux/fb.h> | |
#include <sys/mman.h> | |
#include <sys/ioctl.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <linux/input.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' ); | |
require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' ); | |
require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' ); | |
class WP_Customize_Palette_Control extends WP_Customize_Image_Control { | |
public $type = 'palette'; | |
public $removed = ''; | |
public $context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NameVirtualHost * | |
<VirtualHost *> | |
ServerName fruit.com | |
DocumentRoot /www/html/htdocs/fruitsite/docroot | |
</VirtualHost> | |
<VirtualHost *> | |
ServerName www.apple.com | |
ServerAlias www.banana.com www.cherry.com |