Skip to content

Instantly share code, notes, and snippets.

View syzer's full-sized avatar
🐕
Woof! Woof!

syzer syzer

🐕
Woof! Woof!
View GitHub Profile
@starfys
starfys / fisr.js
Last active January 11, 2024 22:04
Fast inverse square root in Javascript
//Based on the fast inverse square root function
// https://en.wikipedia.org/wiki/Fast_inverse_square_root
// Some original comments preserved for humor value
// Designed to try to mimic the original as closely as possible
function Q_rsqrt(number)
{
var i;
var x2, y;
const threehalfs = 1.5;
@rrag
rrag / .block
Last active July 31, 2021 16:26
Chart with a dark theme
license: MIT
height: 770
@syzer
syzer / gist:a5ebde3031d76744397e
Last active August 29, 2015 14:11
Decorators are awesome
/**
* Created by syzer on 12/19/2014.
* ex shows how to decouple constant error checking from function/class body
* AKA TypeScript AKA WarnScript :)
*/
var _ = require('lodash');
function doStuffNumberPlusOneTimes(number, fun) {
"use strict";
@syzer
syzer / gist:e7a69e8a31205766a7c0
Created November 3, 2014 16:52
FP workshop gist
// task #function composiotion
var articles = [
{
title: 'Why OO Sucks by Joe Armstrong',
url: 'http://www.bluetail.com/~joe/vol1/v1_oo.html',
author: {
name: 'Joe Armstrong',
email: 'empty@email.com'
}
},
{
"result": "SUCCESS",
"interfaceVersion": "1.0.3",
"requested": "10/17/2013 15:31:20",
"lastUpdated": "10/16/2013 10:52:39",
"tasks": [
{
"id": 104,
"complete": false,
"priority": "high",
@kelvinn
kelvinn / cmd.sh
Created July 24, 2014 02:55
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@nateware
nateware / gist:3915757
Created October 19, 2012 01:27
Start Mac VNC server from command line
# Step 1: Set priveleges
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Starting...
Setting allow all users to YES.
Setting all users privileges to 1073742079.
Done.
# Step 2: Allow VNC clients
@mmalecki
mmalecki / nextTick.js
Created October 2, 2011 12:13
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}