Instantly share code, notes, and snippets.

View setup.sh
#!/bin/bash
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DOTNET_ROOT=${SCRIPT_DIR}/.dotnet
BIN_DIR=${SCRIPT_DIR}/bin
DOTNET_INSTALL=${BIN_DIR}/dotnet-install.sh
DOTNET=${DOTNET_ROOT}/dotnet
CAKE=${BIN_DIR}/dotnet-cake
export DOTNET_CLI_TELEMETRY_OPTOUT=1
View release.sh
#!/bin/bash
# This bash script will try to create a new relase and publish an
# npm package at the same time
function confirm()
{
echo -n "$@ "
read -e answer
for response in y Y yes YES Yes Sure sure SURE OK ok Ok
View git-feature
#!/usr/bin/php
<?php
if(count($argv) !== 2) {
die("Need a new branch name\n");
}
$info = pathinfo($argv[0]);
$command = str_replace("git-","",$info["basename"]);
$new_branch = str_replace(array(' ',"\\","\"","\t","\n","\r","-"),'-',$argv[1]);
View custom.js
jQuery(document).ready(function($){
var headerHeight = $('#masthead').outerHeight();
$('#go-top, .next-page').localScroll({
offset: {
top: -headerHeight
}
});
$(window).scroll(function(){
if($(window).scrollTop() > 200){
View material-design-color-extract.js
// Extract Material Design Colors from the specs website.
// open [https://www.google.com/design/spec/style/color.html#color-color-palette] in FireBug
// Then run
console.clear();
var mdPalette = {
};
var sassPalette = [
];
var colorPalette = document.querySelector('.color-palette');
var colorGroups = colorPalette.querySelectorAll('.color-group');
View git-feature
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m'
cur_branch_name=$(git symbolic-ref -q HEAD)
cur_branch_name=${cur_branch_name##refs/heads/}
cur_branch_name=${cur_branch_name:-HEAD}
cache=~/bin
reponame=$(basename $(git rev-parse --show-toplevel))
View jquery-ish.js
console.clear();
var $ = function(selector) {
var list = document.querySelectorAll(selector)
var each = function(callback) {
return function() {
for(var a = 0; a != list.length; a++) {
var obj = list[a];
callback.apply(obj,arguments);
}
return list;
View singleton.ts
/**
* Simple singleton pattern in TypeScript
*/
module Utils {
class GreeterSingleton {
public sayHello(name:string) : void {
alert(`Hello ${name}!`);
}
View php-serve.sh
#!/bin/bash
IPADDR=127.0.0.1
STARTPORT=8000
ENDPORT=9000
found=false
for (( port = $STARTPORT ; port <= $ENDPORT ; port++ )); do
printf "Checking $port\r";
if ! nc -z -w5 $IPADDR $port
then