Skip to content

Instantly share code, notes, and snippets.

William Bowers willurd

Block or report user

Report or block willurd

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
rust-play /
Created Jul 25, 2018
Code shared from the Rust Playground
trait Json {
fn to_string(&self) -> String;
trait Xml {
fn to_string(&self) -> String;
struct Point2 {
sararob / data-structure.js
Last active Aug 3, 2019
Role-based security in Firebase
View data-structure.js
This example shows how you can use your data structure as a basis for
your Firebase security rules to implement role-based security. We store
each user by their Twitter uid, and use the following simplistic approach
for user roles:
10 - USER
raganwald / record.js
Last active Aug 29, 2015
Records, Values, and Structs
View record.js
function Record (template) {
if (Record.prototype.isPrototypeOf(this)) {
var struct = this;
Object.keys(template).forEach(function (key) {
Object.defineProperty(struct, key, {
enumerable: true,
writable: true,
value: template[key]
View overload.js
var __slice = [].slice;
var __noop = function(){};
function typeOf(x) {
return {},-1);
function overload(fs) {
return function() {
var types =;
debasishg / gist:8172796
Last active Nov 18, 2019
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
ahmedelgabri / gist:8122545
Last active Oct 17, 2018
Shell function to open a static server (Python, Ruby or PHP)
View gist:8122545

Static server shell function

A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.

How it works

$ staticServer <lang> <port> #port is optional, default is 8000
katowulf / 1_using_queries.js
Last active Mar 11, 2019
Methods to search for user accounts by email address in Firebase
View 1_using_queries.js
* Simple and elegant, no code complexity
* Disadvantages: Requires warming all data into server memory (could take a long time for MBs of data or millions of records)
* (This disadvantage should go away as we add optimizations to the core product)
var fb = firebase.database.ref();
* @param {string} emailAddress
katowulf / 1_query_timestamp.js
Last active Nov 19, 2019
Get only new items from Firebase
View 1_query_timestamp.js
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP)
// pros: fast and done server-side (less bandwidth, faster response), simple
// cons: a few bytes on each record for the timestamp
var ref = new Firebase(...);
ref.orderByChild('timestamp').startAt('child_added', function(snapshot) {
console.log('new record', snap.key());
dypsilon /
Last active Nov 18, 2019
A badass list of frontend development resources I collected over time.
anantn / firebase_first_item.js
Last active Mar 4, 2016
Firebase: Get the first item in a list. This snippet retrieves only the first item in a list.
View firebase_first_item.js
function makeList(ref) {
var fruits = ["banana", "apple", "grape", "orange"];
for (var i = 0; i < fruits.length; i++) {
function getFirstFromList(ref, cb) {
ref.startAt().limit(1).once("child_added", function(snapshot) {
You can’t perform that action at this time.