Skip to content

Instantly share code, notes, and snippets.

@mathiasbynens
mathiasbynens / .gitignore
Last active August 7, 2024 02:26
Generating a regular expression to match valid JavaScript identifiers (like https://mathiasbynens.be/demo/javascript-identifier-regex) in Node.js
package-lock.json
node_modules
@seanjensengrey
seanjensengrey / 1-cat.js
Created March 21, 2014 20:04
async read of a file
/* open a file and print its contents */
var fs = require('fs');
var cat_file = function(path,stream,completion_callback) {
fs.open(path,'rs',function(err,fd) {
var buf_size = 4096;
var buf = new Buffer(buf_size);
@johanneswuerbach
johanneswuerbach / rails-vagrant-provision.sh
Last active September 29, 2024 21:04
Provision a vagrant box with ruby stable (using rvm), postgres, redis and node (using nvm)
#!/usr/bin/env bash
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8
sudo apt-get update
sudo apt-get install -y build-essential git curl libxslt1-dev libxml2-dev libssl-dev
# postgres
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
R = React.DOM
nations = ['britain', 'ireland', 'norway', 'sweden', 'denmark', 'germany',
'holland', 'belgium', 'france', 'spain', 'portugal', 'italy', 'switzerland']
Typeahead = React.createClass
getInitialState : -> {input: ""}
handleChange : -> @setState input: @refs.field.getDOMNode().value
handleClick : (nation)-> @setState input: nation
matches : (input)->
/**
* Simple userland heapdump generator using v8-profiler
* Usage: require('[path_to]/HeapDump').init('datadir')
*
* @module HeapDump
* @type {exports}
*/
var fs = require('fs');
var profiler = require('v8-profiler');
@rylev
rylev / rust-in-large-organizations-notes.md
Last active June 12, 2025 16:06
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@pims
pims / app.py
Last active June 28, 2025 21:50
Example of running a python script via python-wasi using the wasmtime wasm runtime
print("hello from a python script")