Skip to content

Instantly share code, notes, and snippets.

View Codesleuth's full-sized avatar

David Wood Codesleuth

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / .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 "$@"
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);
declare module 'os-service' {
import { Writable } from 'stream';
interface ServiceOptions {
nodePath?: string;
username?: string;
password?: string;
programPath?: string;
displayName?: string;
nodeArgs?: string[];
@Codesleuth
Codesleuth / yayson.d.ts
Created September 10, 2016 23:13
Partial typings definitions for yayson. Ugly AF
declare module 'yayson' {
class Store {
sync(obj: Object): Object;
sync<T>(obj: Object): T;
}
interface Yayson {
Store: typeof Store;
}
@Codesleuth
Codesleuth / proxyquire.d.ts
Created September 25, 2016 16:28
Proxyquire definitions
interface Proxyquire {
(request: string, stubs: any): any;
<T>(request: string, stubs: any): T;
load(request: string, stubs: any): any;
load<T>(request: string, stubs: any): T;
noCallThru(): Proxyquire;
callThru(): Proxyquire;