Skip to content

Instantly share code, notes, and snippets.

@fhk
fhk / lp_solver_wasm.md
Last active February 5, 2024 15:20
Compiling a linked linear programming solver library

Linear Programming Solver running in the browser?

So I wanted to see if I could get a solver running in the browser.

Why you might ask? Well its pretty typical to need to deploy a back end for a webapp or even to have a specific install on your OS.

This makes things clunky if we wanted to say:

  1. Visualize solutions in realtime using some js libs on the client side
  2. Solve models on the client side of a web app
@gaearon
gaearon / combining.js
Created June 3, 2015 18:03
Combining Stateless Stores
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
# This is a list of matchers that we use in our RSpec tests at Causes.
# *** CAPYBARA MATCHERS ***
#
# To check for content on a page, don't use `include`, use `have_content`:
response.body.should have_content 'A header'
# As opposed to `include`, this Capybara matcher will only look for content
# (ignoring tags and meta-info etc). And the error message is slightly easier to
@rf-
rf- / grd
Created February 1, 2013 21:40
#!/usr/bin/env ruby
# grd: micro Guard.
#
# Watch one or more filename patterns and then run the given command every time
# something changes.
#
# Example:
# grd my_model "rspec spec/models/my_model_spec.rb"
@jnovack
jnovack / pushover.pl
Last active March 28, 2018 19:08
pushover.pl - Sends irssi notifications to Pushover
use strict;
use warnings;
# {{{ DOCUMENTATION
#####
# A lot of code borrowed from the prowlnotify.pl script at
# http://www.denis.lemire.name/2009/07/07/prowl-irssi-hack/
# and pushovernotify.pl (Daniel Johansson <donnex@donnex.net>)
# and http://www.geekfarm.org/wu/muse/scripts/growl-notify.txt
#
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 23, 2024 19:14
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@kordless
kordless / square-fail.mail
Created March 29, 2011 00:08
square-fail.mail
MIME-Version: 1.0
Received: by 10.227.0.101 with HTTP; Mon, 28 Mar 2011 17:02:53 -0700 (PDT)
Reply-To: kord@loggly.com
In-Reply-To: <8D77F7E047BC4921A2F15228F9FC111C@maxhire.net>
References: <8D77F7E047BC4921A2F15228F9FC111C@maxhire.net>
Date: Mon, 28 Mar 2011 17:02:53 -0700
Delivered-To: kordless@loggly.com
Message-ID: <AANLkTimqfp-7pVzSnsJMVH3=9QZqQnA+Hoyi=uqy-ccU@mail.gmail.com>
Subject: Re: Square
@sunlightlabs
sunlightlabs / levenshtein.rb
Created August 19, 2009 18:07
Ruby C implementation of Levenshtein
# C implementation of Levenshtein text distance algorithm, uses RubyInline to call from within Ruby
# Wildly faster than the Text gem's Text::Levenshtein
# Example:
# l = Levenshtein.new
# l.distance 'hello', ' hello'
# => 1
# Taken from http://www.benallfree.com/2008/10/05/finding-duplicate-text-with-ruby/