Skip to content

Instantly share code, notes, and snippets.

View wegry's full-sized avatar

Zach Wegrzyniak wegry

  • Northeastern University
  • Boston
  • 00:04 (UTC -04:00)
View GitHub Profile
@pilwon
pilwon / test-es6-imports.js
Created March 29, 2015 06:57
Tests if regex matches all valid ES6 import syntaxes. https://github.com/facebook/react-native/pull/386
//
// Tests if regular expression matches all valid ES6 import syntaxes.
//
// ES6 Language Specification Reference:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
//
const ES6_IMPORT_REGEX = /\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/g;
const VALID_ES6_IMPORT_SYNTAXES = [
@hoitomt
hoitomt / log_request.go
Created January 30, 2015 12:56
Golang: Log HTTP Requests in Go
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
@vbfox
vbfox / Dapper.fs
Last active April 21, 2022 02:58
Minimal dapper in F#
module DapperFSharp =
open System.Data.SqlClient
open System.Dynamic
open System.Collections.Generic
open Dapper
let dapperQuery<'Result> (query:string) (connection:SqlConnection) =
connection.Query<'Result>(query)
let dapperParametrizedQuery<'Result> (query:string) (param:obj) (connection:SqlConnection) : 'Result seq =
@davidwindell
davidwindell / git-timestamp.sh
Last active January 9, 2024 11:42
Set a files last modified time to match it's git commit timestamp
#!/bin/bash -e
####
# based on http://www.clock.co.uk/blog/a-guide-on-how-to-cache-npm-install-with-docker
#
# Set's the last modified timestamp of a file to it's repositories commit timestamp.
#
# Particularly useful with docker when building after a new git checkout has been made,
# can improve docker build times for composer, bower, npm, etc
#
# @see https://github.com/docker/docker/issues/3556
@eyeseast
eyeseast / diversity.py
Created June 21, 2014 00:28
A python implementation of the USA Today Diversity Index, first developed by Phil Meyer and Shawn McIntosh of USA Today in 1990; updated in 2000 by Meyer and Paul Overberg.
#!/usr/bin/env python
"""
A python implementation of the USA Today Diversity Index, first developed by
Phil Meyer and Shawn McIntosh of USA Today in 1990; updated in 2000 by Meyer
and Paul Overberg.
Source and explanation: http://ire.org/resource-center/tipsheets/3473/
"""
def simple(*categories):
@theburningmonk
theburningmonk / gist:3363893
Created August 15, 2012 21:34
F# - converting a C# dictionary to a Map
let toMap dictionary =
(dictionary :> seq<_>)
|> Seq.map (|KeyValue|)
|> Map.ofSeq