Instantly share code, notes, and snippets.

View niceDate.php
<?php
/**
* Convert DB timestamp to nice looking string with many variations
*
* @param string $date - Database Timestamp
* @param int/bol $style - Date Layout, false for DD.MM.YYYY HH:MM, 1 for DD.MM.YYYY HH:MM:SS, 2 for DD.MM.YYYY, 3 for HH:MM, 4 for DD Month YYYY, 5 for Weekday, DD.MM.YYYY, 6 for MM.YYYY, 7 for WW-YYYY
* @param string $local - Default language is german
* @return string $date_nice
*
*/
View multipleCounting.sql
SELECT
SUM(CASE WHEN foo = '0' THEN 1 ELSE 0 END) AS bar_count,
SUM(CASE WHEN foo = '1' OR foo = '2' THEN 1 ELSE 0 END) AS baz_count
FROM
database
WHERE
baz = qux
GROUP BY baz
View delete_local_indexedDB.js
window.indexedDB.webkitGetDatabaseNames().onsuccess = function(sender,args){
var r = sender.target.result;
for(var i in r)
{
indexedDB.deleteDatabase(r[i]);
}
};
View countdown.js
/**
*
* Simple Countdown Function
* @param {num} duration - in Milliseconds
* @param {string} elemID - DOM Object ID to show the Countdown
*
*/
function countdown(duration, elemID) {
var start = Date.now( );
View karma.conf.js
(function ( module ) {
'use strict';
module.exports = function( config ) {
config.set({
basePath : '../',
urlRoot: '/base/',
View outline.css
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
View errors_tpl.html
<small class="error" ng-message="minlength" validate-minlength>Please enter at least {{requiredMinLength}} characters</small>
View install_gettext.sh
#!/usr/bin/sh
# Scipt for installing mcrypt.so extension for PHP 5.3.13 (default PHP for OS X 10.8 Mountain Lion)
mkdir /tmp/gettext
cd /tmp/gettext
curl --location --progress-bar http://us.php.net/get/php-5.3.13.tar.gz/from/nl.php.net/mirror | tar -zx
brew update
View Export each as SVG.js
// Fireworks JavaScript Command
// Exports current document state as SVG graphics format
// Install by copying to Fireworks/Configuration/Commands/
// Run via the Commands menu in Fireworks
// Aaron Beall 2010-2011
// Version
var VERSION = "0.6.1";
// Params
View svg_filters.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.