Skip to content

Instantly share code, notes, and snippets.

View lambder's full-sized avatar

Lambder lambder

View GitHub Profile
@lambder
lambder / gist:2066588
Created March 17, 2012 23:36
The Zen of R
# I am a scientist who has been using R for about 2 years. Today I achieved a measure of enlightenment into
# the zen of R, and I want to share it with you.
# I was simulating a set of independent random walks, which are formed by a multiplicative process. Here is
# the code I had built up over a few months of working on it and modifying it on and off as research
# questions changed:
TimeSteps <- 1000
Walks <- 100
ErrorMagnitude <- 0.03
@lambder
lambder / extend-array-type.clj
Created December 22, 2011 12:15
Example of extending native Java array types to Clojure protocols
; Copyright (c) Daniel Kwiecinski. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;
; Example of extending native Java array types to Clojure protocols
@lambder
lambder / gist:d71eb91dcf0d2a2ceb15
Created January 12, 2016 15:42 — forked from city41/gist:aab464ae6c112acecfe1
ClojureScript secretary client side navigation without hashes

This is the example that comes with the reagent template converted to use HTML5 based history. This means there are no # in the urls.

I just got this working, so there might be better approaches

The changes are

  • use goog.history.Html5history instead of goog.History
  • listen to clicks on the page, extract the path from them, and push them onto the history
  • listen to history changes, and have secretary do its thing in response
@lambder
lambder / latency.txt
Created January 31, 2017 17:08 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@lambder
lambder / README.md
Created January 30, 2017 17:03 — forked from cs8425/README.md
How to REAL install Remix OS on VirtualBox

How to REAL install Remix OS on VirtualBox

This is how to REAL install Remix OS on VirtualBox. rootfs could be writable!!!

Needs:

  • any linux liveCD iso file (Xubuntu here)
  • Remix OS iso file ("Remix_OS_for_PC_Android_M_32bit_B2016092201.iso" here)
  • VirtualBox
@lambder
lambder / auxpattern.scala
Created December 30, 2016 17:57 — forked from gigiigig/auxpattern.scala
Aux Pattern
import shapeless._
import scalaz._
import Scalaz._
object console extends App {
trait Foo[A] {
type B
def value: B
@lambder
lambder / property-based-testing-tools.md
Created October 29, 2016 08:35 — forked from npryce/property-based-testing-tools.md
Property-Based Testing Tools

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python:

@lambder
lambder / angularjs_directive_attribute_explanation.md
Created August 16, 2016 09:48 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@lambder
lambder / Counter.elm
Created May 18, 2016 16:34 — forked from pdamoc/Counter.elm
Widget Union
module Counter exposing (..)
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
-- MODEL
type alias Model = Int