Skip to content

Instantly share code, notes, and snippets.

@thinkt4nk
thinkt4nk / datetime.php
Created August 16, 2018 23:34 — forked from graste/datetime.php
PHP DateTime class – parsing and formatting ISO8601 dates with or w/o fractions of a second
<?php
echo 'default locale: ' . \Locale::getDefault();
echo PHP_EOL;
echo 'default timezone: ' . \date_default_timezone_get();
echo PHP_EOL;
// see http://tools.ietf.org/html/rfc3339#section-5.8 for example datetimes
// bug report on missing fractions support: https://bugs.php.net/bug.php?id=51950
// feature request for fractions support in constructor: https://bugs.php.net/bug.php?id=49779
### Keybase proof
I hereby claim:
* I am thinkt4nk on github.
* I am ryanbales (https://keybase.io/ryanbales) on keybase.
* I have a public key whose fingerprint is C572 6356 A206 F878 70D0 EA4E 4CE1 54BE 0F9B F3ED
To claim this, I am signing this object:
@thinkt4nk
thinkt4nk / GIF-Screencast-OSX.md
Last active November 10, 2016 18:09 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

QUERY ::= 'SELECT' ('COUNT()' | (FIELD ( ',' FIELD)*))
'FROM' (NAME ('AS' ? NAME)? ('USING' NAME)?) ( ',' NAME ('AS' ? NAME)? ('USING' NAME)?)*
('WHERE' CONDITIONEXPR )?
('ORDER BY' ORDERBYEXPR)?
('LIMIT' POSINTEGER )?
FIELD ::= NAME | '(' QUERY ')'
CONDITIONEXPR ::= ANDEXPR | OREXPR | NOTEXPR | SIMPLEEXPR
ANDEXPR ::= 'AND' SIMPLEEXPR
OREXPR ::= 'OR' SIMPLEEXPR
NOTEXPR ::= 'NOT' SIMPLEEXPR
@thinkt4nk
thinkt4nk / ambition_api_c#_example.cs
Last active September 28, 2015 20:55 — forked from joshmarlow/ambition_api_c#_example.cs
Ambition API - C# Example
/*
* upload_to_ambition.cs
* Simple program demonstrating how to upload data to the Ambition Data API
*
* This code needs to be linked to the System.Web.Extensions assembly.
*
* For mono, use 'gmcs ambition_api_c#_example.cs -r:System.Web.Extensions'
*/
using System;
01. Die Krupps - Robosapien
02. KMFDM - Lust
03. Ministry - We Believe
04. Decoded Feedback - Breathe
05. Front 242 - Red Team
06. SA42 - Race of the Human Race
07. Portion Control - Swerve
08. Noise Unit - Firing Line
09. Autodafeh - Treasure Hunt
10. Orange Sector - Sturm (Martin Bodewell Remix)
@thinkt4nk
thinkt4nk / even-width.js
Last active August 29, 2015 14:05
Even, whole element width with even, whole margin
var fullWidth = 290
var numberOfElements = 7
var positionOffset = 0
process.argv.forEach(function(arg) {
var offsetRegexp = /--offset=(\d+)/
if (offsetRegexp.test(arg))
positionOffset = parseInt(arg.replace(offsetRegexp, '$1'))
})
@thinkt4nk
thinkt4nk / apache-execution-time.js
Created June 23, 2014 17:44
Parse Log Files - Execution Time
#!/usr/bin/env node
var fs = require('fs');
var moment = require('moment');
if (!!~process.argv.indexOf('-p') && process.argv.length === 4)
parseLog(process.argv[3]);
else if (!!~process.argv.indexOf('-d')) {
var infile = (process.argv.length > 3) ? process.argv[3] : null;
dailyAverages(infile);
}
@thinkt4nk
thinkt4nk / confirm_code.php
Last active August 29, 2015 13:57
Random Confirm Code Generator
<?
class confirm_code
{
protected static function generate_random_bytes($length=16){
if(function_exists('openssl_random_pseudo_bytes')) {
$rnd = openssl_random_pseudo_bytes($length, $strong);
if ($strong === TRUE)
return $rnd;
}
@thinkt4nk
thinkt4nk / pre-commit.py
Created November 30, 2011 21:43
git hook for resetting files before commit
#!/usr/bin/python
import os
import sys
ignore_paths = ['apps/ppc/templates/_scripts.php']
# chdir to project root
os.chdir(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..','..'))
# for each path, reset and re-checkout before commit
for path in ignore_paths:
ignore_file = os.path.join(os.getcwd(),path)