Skip to content

Instantly share code, notes, and snippets.

@bendc
bendc / functional-inheritance.js
Last active July 9, 2016 16:03
Functional inheritance
function car() {
return {
start: function() {
console.log("Engine on.")
},
accelerate: function() {
console.log("Let's go!")
}
}
}
Interconnect: LAN(1GB)
Server: 12 core Xeon E5-2620 at 2Ghz, 16GB RAM
Client running on idle node with similar h/w configuration. Used latest wrk2 release
https://github.com/giltene/wrk2
Tried different configuration options, results for configuration that gave best results
See also: https://gist.github.com/markpapadakis/dee39f95a404edfb8d6c
# Apache2: http://10.5.5.20/index.html
Requests/sec: 83704.15
> More or less expected that kind of throughput
// A simple LUT backed index for faster binary search, with LUT partition encoding
// A bloom filter can be attached to it, for when you have many, many values - though in practice
// it is rarely needed, especially if the bits(resolution) is over 16
//
// You need (1 << bits) * sizeof(T::key) for the lut, e.g if T::key is uint32_t, for a 16bits LUT, that's
// 262k. Increasing resolution results in higher lookup efficiency, reducing it results in lower memory requirements
template<typename T>
static __attribute__((always_inline)) constexpr T MSB(const T n, const uint8_t span)
{
@tkafka
tkafka / LICENSE.txt
Last active May 17, 2024 02:08
Drop-in replacement for ReactCSSTransitionGroup that uses velocity.js instead of CSS transforms. Add your own transitions to `transitions` hash.
The MIT License (MIT)
Copyright (c) 2014 Tomas Kafka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
// Ref: http://iaroslavski.narod.ru/quicksort/DualPivotQuicksort.pdf
template<typename T>
void DualPivotQuickSort(T *lo, T *hi, const std::function<int32_t(const T &, const T&)> &cmp)
{
auto *const hiMinus1 = hi - 1;
if (hi - lo < 3)
{
if (hi != lo && cmp(*lo, *hiMinus1) > 0)
{
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@idleberg
idleberg / DropboxIgnore.md
Last active June 4, 2023 12:02
Ignore node_modules/bower_components folders in your Dropbox

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@IzumiSy
IzumiSy / manifest.json
Last active November 6, 2022 20:29
Chrome.storage.sync example
{
"name": "SyncExtension",
"version": "0.1",
"manifest_version": 2,
"description": "Storage Sync Extension",
"permissions": [ "storage" ],
"browser_action": {
@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@tomashanacek
tomashanacek / Fit artboard to selection.sketchplugin
Last active August 29, 2015 14:03
Fit artboard to selection
var currentArtboard = [[[doc currentPage] artboards] firstObject];
var layers = selection;
var bounds = getBoundsForLayers(layers);
for (var i = 0, len = [layers count]; i < len; ++i) {
var layer = [layers objectAtIndex:i];