Skip to content

Instantly share code, notes, and snippets.

View bryangreen's full-sized avatar

Bryan Green bryangreen

View GitHub Profile
@tozwierz
tozwierz / gist:76be651cc7a7d5c06ea290eec8a0ed73
Last active October 17, 2023 11:21
TDD: Socket.io + Jest Boilerplate
const io = require('socket.io-client');
const http = require('http');
const ioBack = require('socket.io');
let socket;
let httpServer;
let httpServerAddr;
let ioServer;
/**
@guitarrapc
guitarrapc / SendToChatwork.cs
Created December 20, 2016 18:33
AWS Lambda on .NET Core sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Chatwork.Service;
using Amazon.Lambda.Core;
using Amazon.Lambda.Serialization;
using Newtonsoft.Json;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@brucekirkpatrick
brucekirkpatrick / jquery.unserialize.js
Last active March 11, 2018 22:59 — forked from rcmachado/jquery.unserialize.js
Takes a string in format "param1=value1&param2=value2" and returns an javascript object. Improved to handle multiple values with same name and to unescape url encoded values.
/**
* $.unserialize
*
* Takes a string in format "param1=value1&param2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array.
*
* Example:
*
* Input: param1=value1&param2=value2
* Return: { param1 : value1, param2: value2 }
*
@antonmedv
antonmedv / DotNotation.php
Last active August 11, 2022 13:47
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*
@lavoiesl
lavoiesl / before.rules
Created September 18, 2012 02:24
Rate limit HTTP requests using UFW
### Add those lines after *filter near the beginning of the file
:ufw-http - [0:0]
:ufw-http-logdrop - [0:0]
### Add those lines near the end of the file
### Start HTTP ###
@dav-rob
dav-rob / gist:3145802
Created July 19, 2012 18:21
3 Letters Plus Number String Sort
package com.cs.cts.crm.elasticsearch.util;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.elasticsearch.script.AbstractFloatSearchScript;
import org.elasticsearch.script.ExecutableScript;
import org.elasticsearch.script.NativeScriptFactory;
@tony-landis
tony-landis / array-to-texttable.php
Created December 3, 2008 08:00
PHP: Array to Text Table Generation Class
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <[email protected]>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable