A simple function for allowing partial function application in JavaScript.
function foo(a, b, c) {
return [a, b, c]
}
var bar = foo.curry(1, 2)
bar(3) // => [1, 2, 3]
A simple function for allowing partial function application in JavaScript.
function foo(a, b, c) {
return [a, b, c]
}
var bar = foo.curry(1, 2)
bar(3) // => [1, 2, 3]
# Truncate paths in the prompt to 2 characters so long directories don't take up the whole window | |
function Prompt { | |
$path = $ExecutionContext.SessionState.Path.CurrentLocation | |
$segment = Split-path -Leaf $path | |
$path = Split-Path $path | |
$segments = @( $segment ) | |
while ($segment -ne $path -and $path -ne "") { | |
$segment = Split-Path -Leaf $path |
using System; | |
namespace ConsoleApplication1 | |
{ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
try | |
{ |
// paste this into a LINQPad C# Program | |
void Main() | |
{ | |
var str = @"Key1=Value1 | |
Key2:Key3=Value2"; | |
var strings = str.Split(new []{"\r\n"}, StringSplitOptions.None) | |
.Select(s => s.Split(new[]{'='}, 2)); | |
Set a URL ACL for the current user to listen on a specific port
netsh http add urlacl url=http://+:44444/ user=DOMAIN\username
netsh http add urlacl url=https://localhost:44300/ user=DOMAIN\username
netsh http add urlacl url=https://hostname:44300/ user=DOMAIN\username
netsh http add urlacl url=https://hostname.domain.ext:44300/ user=DOMAIN\username
View current URL ACLs
#!/usr/bin/env ruby | |
# usage: dotenv irb | |
begin | |
File.foreach('.env') do |line| | |
line = line.strip | |
unless line.start_with?('#') | |
parts = line.split '=', 2 | |
if parts.length == 2 |
using System; | |
class Program | |
{ | |
static void One() { Two(); } | |
static void Two() { Three(); } | |
static void Three() { throw new Exception("Error"); } | |
static void Main(string[] args) | |
{ |
function fn1() { | |
return function fn2(ARG1) { | |
return callApi({ foo: ARG1 }) | |
.then(handler); | |
function handler(response) { | |
const obj = { PROP: response }; | |
return (inlinedFunction(obj.PROP)) | |
.then(fn3()); | |
} |
static function redirectHttpsToHttp(oSession: Session, fromHost, toHost) { | |
if (oSession.HostnameIs(fromHost)) | |
{ | |
// Handle CONNECT Tunnels | |
if (oSession.HTTPMethodIs("CONNECT")) | |
{ | |
oSession["x-replywithtunnel"] = "FakeTunnel"; | |
return true; | |
} |
#!/bin/bash | |
set -exuo pipefail | |
TRUNK=master | |
REWRITE_BRANCH=master-to-rewrite | |
NEW_BRANCH_BOOKMARK=master-filtered | |
LAST_IMPORT_BRANCH=master-lastimport | |
STATE=master-state | |
INDEX_FILTER_SCRIPT='git rm -r --cached --ignore-unmatch bad_directory' |