Skip to content

Instantly share code, notes, and snippets.

Matthew Simpson msimpson

Block or report user

Report or block msimpson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@msimpson
msimpson / !wasmllvm.md
Last active May 7, 2019 — forked from yurydelendik/!wasmllvm.md
Using WebAssembly in LLVM on Windows
View !wasmllvm.md

Using WebAssembly in LLVM on Windows

Forewarning: this can be a bit painful and may not work as expected. I've already had issues with even including stdlib through clang.

Installing Dependencies

GIT

Make sure you have git installed and properly configured before continuing. This is trivial on Windows these days (https://git-scm.com/download/win) but is required to pull down Binaryen and Wabt.

Make sure to add the binary to your PATH variable in Windows.

View .bashrc
#
# .bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
#
# Completion
#
View Poker Hand Evaluation Example
#!/usr/bin/env node
// Test Hand
var hand = [
{ rank: 10, suit: 1 },
{ rank: 11, suit: 1 },
{ rank: 12, suit: 1 },
{ rank: 13, suit: 1 },
{ rank: 14, suit: 1 }
View jquery.mousewheel.js
/*!
* jQuery Mousewheel 3.1.12
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
(function (factory) {
if ( typeof define === 'function' && define.amd ) {
@msimpson
msimpson / scroll-test.html
Last active Jan 26, 2018
Mac OSX Inertial Scrolling Buffer (http://jsfiddle.net/n7bk6pb9/1/)
View scroll-test.html
<!doctype html>
<html>
<head>
<title>Scroll Test</title>
<style>
html, body {
overflow: hidden;
width: 100%;
height: 100%;
@msimpson
msimpson / Clock
Last active Jul 8, 2019
Unfinished python clock
View Clock
#!/usr/bin/python
# -*- coding: utf-8 -*-
import curses
from math import floor
from datetime import datetime as date
from subprocess import Popen as popen
# Globals:
screen = curses.initscr()
@msimpson
msimpson / pip_example.js
Created Jan 9, 2012
Point Inside Polygon
View pip_example.js
var data = {
polygon: [[0,0], [0,2], [1,3], [2,1], [3,2], [4,0], [3,1], [2,0], [1,1]],
a: [2, 2],
b: [1, 2]
};
function pointInPolygon(polygon, point) {
var len = polygon.length,
x = point[0], y = point[1],
j = len - 1, i = 0, c = 0;
View .Xdefaults
urxvt.termName: rxvt
urxvt.loginShell: true
urxvt*urlLauncher: /usr/bin/chromium
urxvt*perl-lib: /usr/lib/urxvt/perl/
urxvt*perl-ext-common: default,matcher,searchable-scrollback
urxvt*font: xft:DejaVu Sans Mono:pixelsize=10
urxvt*boldFont: xft:DejaVu Sans Mono:pixelsize=10
urxvt.scrollBar: false
urxvt.saveLines: 65535
urxvt.secondaryScroll: true
@msimpson
msimpson / tip.rb
Created Aug 20, 2011
Tip Calculator
View tip.rb
#!/usr/bin/env ruby
# Tip Calculator
# Usage: ./tip <cost> <minutes_waited> [percent]
exit if ARGV.length < 2
cost = ARGV[0].to_f.round(2)
minutes = ARGV[1].to_i
percent = !ARGV[2].nil? ? ARGV[2].to_f / 100.0 : 0.2
@msimpson
msimpson / poker
Created Jul 24, 2011
A library to rank and compare poker hands.
View poker
#!/usr/bin/env ruby
# encoding: UTF-8
# - Poker -
# A library to rank and compare poker hands.
module Poker
ACE = 14
KING = 13
QUEEN = 12
You can’t perform that action at this time.