Skip to content

Instantly share code, notes, and snippets.

View Codesleuth's full-sized avatar

David Wood Codesleuth

View GitHub Profile
declare module 'hot-shots' {
interface ClientOptions {
host?: string;
port?: number | string;
}
class StatsDClient {
constructor(options?: ClientOptions);
increment(stat: string);
increment(stat: string | string[], value: number, sampleRate: number, tags: string[], callback: Function);
@Codesleuth
Codesleuth / .bashrc
Created April 26, 2016 10:47
hitch and PS1 with Git Bash for Windows 2.8+
git_author() {
if [ -z "$GIT_AUTHOR_NAME" ]; then
echo "developer"
else
echo "$GIT_AUTHOR_NAME"
fi
}
hitch() {
command hitch "$@"
@Codesleuth
Codesleuth / refresh-pi.sh
Created February 22, 2016 08:28
Refresh a Chromium window on Raspberry Pi via SSH with F5
ssh $1 -Y -t 'export DISPLAY=:0.0
xdotool key --window "$(xdotool search --onlyvisible --class chromium | head -n 1)" F5'
@Codesleuth
Codesleuth / Talking Points.md
Last active February 11, 2016 08:50
TypeScript talk overview

Features

  • Optional static typing
  • Classes
  • Inheritence
  • Interfaces
  • Visibility
    • Accessors
  • Namespaces
  • Modules
  • Type inference - stay dynamic
@Codesleuth
Codesleuth / README.md
Last active February 3, 2016 08:42
Require dev branch in PHP with composer

Require dev branch in PHP with composer

  1. Initialise your composer

    $ php composer.phar init
  2. Require the package as normal - for this, we're demonstrating with esendex/sdk

@Codesleuth
Codesleuth / httpreceiver.js
Created February 2, 2016 08:40
A simple HTTP server which prints request information and returns 200
var http = require('http');
var server = http.createServer(function (req, res) {
var datas = [];
req.on('data', function (data) {
datas.push(data);
});
req.on('end', function () {
console.log('>-------------------->');
console.log(new Date);
console.log(req.method + " " + req.url);
@Codesleuth
Codesleuth / incrementing_list.sql
Created January 28, 2016 10:47
SQL Server Create Incrementing List
DECLARE @s VARCHAR(8000)
SELECT @s = COALESCE(@s + ',', '') + '@Thing' + CONVERT(nvarchar,[number])
FROM [master].[dbo].[spt_values]
WHERE [name] is null and [number] between 0 and 197
SELECT @s
@Codesleuth
Codesleuth / Retryable SQL Script.md
Last active January 26, 2016 13:09
Retryable SQL

Retryable SQL Script

Allows retrying a SQL script until a lock can be achieved necessary to do the work.

@Codesleuth
Codesleuth / Semantic UI Template for Paginate (Almost) Anything.md
Last active July 11, 2017 15:33
Semantic UI Template for Paginate (Almost) Anything
@Codesleuth
Codesleuth / parser.js
Last active April 19, 2016 12:16
Some sort of CSV parser
var readline = require('readline')
var fs = require('fs')
var stream = require('stream')
var util = require('util')
var Transform = stream.Transform
var iconv = require('iconv-lite');
function CSVer(options) {
this.line = ''