Skip to content

Instantly share code, notes, and snippets.

@atk
atk / LICENSE.txt
Created June 19, 2011 23:10 — forked from 140bytes/LICENSE.txt
polyfill an ES5-compatibile Array.isArray where needed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alex Kloss <alexthkloss@web.de>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jonmaim
jonmaim / zip.php
Last active January 22, 2024 00:19
PHP script to remotely create zip archives of your FTP
<?php
/*
*
* This script will backup your web site by remotely archiving all files on the root FTP directory.
* It will work even if your web server is memory limited buy splitting zips in several arhive files it they are too many files.
* All zip files will be stored in a directory called temporary which must be writable.
*
* How to use it:
* - Place the script at the root of your FTP.
@xeoncross
xeoncross / timezone.php
Created September 8, 2011 18:43
The perfect TimeZone selectbox list for PHP 5.3+
<?php
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Aisa' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
@fennb
fennb / gist:1283573
Created October 13, 2011 06:35
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@unicodefreak
unicodefreak / gist:1901458
Created February 24, 2012 14:59
Include tag for underscore template
// based on http://emptysquare.net/blog/adding-an-include-tag-to-underscore-js-templates/
// include tag for underscore templates
// <% include template-id %>
var _underscore_template = _.template;
_.template = function(str, data) {
// match "<% include template-id %>"
return _underscore_template(
str.replace(
/<%\s*include\s*(.*?)\s*%>/g,
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@hurjas
hurjas / timestamp.js
Created May 11, 2012 15:35 — forked from jonkemp/timestamp.js
Print out a nicely formatted timestamp in JavaScript.
/**
* Return a timestamp with the format "m/d/yy h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time
@kommen
kommen / dnsmasq.conf
Created May 19, 2012 10:13 — forked from MSch/dnsmasq.conf
dnsmasq configuration for tunlr.net/pandora.com/hulu/netflix
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
# The following two options make you a better netizen, since they
# tell dnsmasq to filter out queries which the public DNS cannot
# answer, and which load the servers (especially the root servers)
# unnecessarily. If you have a dial-on-demand link they also stop
@bhurlow
bhurlow / gist:3861616
Created October 9, 2012 21:36
Better XML to JSON parsing for cdata
// Changes XML to JSON
// fixed some bugs from http://davidwalsh.name/convert-xml-json
// October 9, 2012
// Brian Hurlow
function xmlToJson(xml) {
// Create the return object
var obj = {};
// console.log(xml.nodeType, xml.nodeName );