Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@tolitius
tolitius / bootcamp.factorial.clj
Created February 2, 2012 04:36
clojure bootcamp: loop/recur vs. reduce vs. recursion
(ns bootcamp.factorial)
(defn fast-factorial [number]
(loop [n number factorial 1]
(if (zero? n)
factorial
(recur (- n 1) (* factorial n)))))
(defn fast-no-loop-factorial
([number] (fast-no-loop-factorial number 1))
@netmute
netmute / README.md
Last active October 27, 2022 13:22
Game of Life

Game of Life

An implementation of Conway's Game of Life in 140 characters of Ruby.

Author

Created by Simon Ernst (@sier).

String

Concepts
  • Creating / Definition
  • Single vs. Double Quoted Strings
  • Combining Strings and Other Data
    • Concatenation with +
    • Wrapping in an Array and using join
  • Interpolating
@komiga
komiga / murmur3_constexpr.cpp
Created April 28, 2012 21:20
MurmurHash3 in C++11 using constexpr!
#include <cstddef>
#include <cstdint>
#include <cstdio>
namespace util {
struct funcs;
template <typename S> struct mh3_internal;
template <typename S, S default_seed> struct mh3;
typedef mh3<uint32_t, 0> mh3_default;
@mikehaertl
mikehaertl / gist:3258427
Created August 4, 2012 15:40
Learn you a Haskell - In a nutshell

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
@gsluthra
gsluthra / tree_html5.html
Created August 20, 2012 07:10
Fractal Tree Generation using HTML5 Canvas and Random Numbers
<html>
<head>
<script type="text/javascript">
window.onload = draw;
function draw(){
@railwaycat
railwaycat / mac-switch-meta.el
Created August 28, 2012 13:43
meta key switch
;; Keybonds
(global-set-key [(hyper a)] 'mark-whole-buffer)
(global-set-key [(hyper v)] 'yank)
(global-set-key [(hyper c)] 'kill-ring-save)
(global-set-key [(hyper s)] 'save-buffer)
(global-set-key [(hyper l)] 'goto-line)
(global-set-key [(hyper w)]
(lambda () (interactive) (delete-window)))
(global-set-key [(hyper z)] 'undo)
@benolee
benolee / 00-creating-a-ruby-extension.md
Last active August 6, 2017 17:18
how easy it is to create and load a C extension in ruby

create a new dir

$ mkdir /tmp/ruby
$ cd /tmp/ruby

create extconf.rb

@mattyclarkson
mattyclarkson / LICENSE
Last active November 11, 2023 20:28
Compile time Murmur3_32 implementation using C++11 constexpr
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
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:
@vkravets
vkravets / X11FullscreenHelper.java
Created April 12, 2013 08:49
Java Full Screen window on Linux OSs using native X11 calling
package org.linux.X11;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.platform.unix.X11;
import java.awt.*;
/**
* Author: Vladimir Kravets