Skip to content

Instantly share code, notes, and snippets.

View bitops's full-sized avatar

Sebastian Wittenkamp bitops

View GitHub Profile
@bitops
bitops / t4r-client-examples.rb
Created August 28, 2011 08:34 — forked from mbbx6spp/t4r-client-examples.rb
Examples of using Twitter4R (Ruby gem library to access the Twitter.com REST and Search APIs).
# Below are examples of how to initialize and use a Twitter::Client object for each Twitter user
# Can initialize by passing in Hash of oauth_access information for the authenticated user driving calls
# through Twitter4R
twitter = Twitter::Client.new(:oauth_access => {
:key => ACCESS_KEY, :secret => ACCESS_SECRET })
# Can also initialize by loading in file configuration file and specifying YAML key name to use for user:
twitter = Twitter::Client.from_config("file/name/to/config.yml", "key") # YAML file will look like twitter.yml
##### STATUS APIs ######
@bitops
bitops / sebastians_margaritas.txt
Created October 20, 2011 04:49
Sebastian's Margarita Recipe
This is my award-winning recipe for margaritas. They've led to more than one good party.
The recipe is "paella-style", meaning it's not exact and a lot of eyeballing is required.
I recommend tasting throughout, ideally with a sober partner in crime.
Tools you'll need:
- lemon and lime squeezers OR powerful hands (probably best to get the squeezers, they're no more than $20)
- pitcher(s) - this recipe easily makes 2 full pitchers
- margarita glasses (or plain old cups)
@bitops
bitops / sebastians_ramen.txt
Created October 20, 2011 05:08
Sebastian's Almost Ramen Noodles
This is my recipe for (sort of) ramen noodles. There's no broth involved but my vegetarian friends are pretty happy when I make this. Super easy to make and very filling.
This recipe assumes that you are using a gas stove and can modulate heat on the fly.
Tools you'll need:
- a good knife (or whatever you like to chop with)
- a wok
- a pot for making the noodles
Ingredients:
@bitops
bitops / gist:1309707
Created October 24, 2011 18:21
Not doing PHP correctly?
<?php
class Dummy {
public $foos = array();
public function & getFoos() {
return $this->foos;
}
public function addFoo($foo) {
@bitops
bitops / jj
Created October 25, 2011 19:44
Pretty print JSON - ruby script
#!/usr/bin/env ruby
#
# Put this script in a bin directory and mark it as executable.
# You can now pipe unformatted json files to the script and
# pretty printed json will come out the other end.
#
# Has no external dependencies in Ruby 1.9.x
# Requires the json gem in Ruby 1.8.x
#
require 'json'
@bitops
bitops / say_hello.sh
Created November 10, 2011 19:38
An example of the say command
say "Hi Khiem this example is for you"
;; bitops's solution to Find the odd numbers
;; https://4clojure.com/problem/25
#(filter
(fn [n] (not (= 0 (mod n 2)))) %)
@bitops
bitops / ants.clj
Created December 13, 2011 21:55 — forked from michiakig/ants.clj
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT 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.
;dimensions of square world
@bitops
bitops / accumulator.clj
Created December 24, 2011 13:02
My first implementation of a simple accumulator in Clojure.
;; Basic integer accumulator.
(def acc (atom 0))
(defn accu
"Basic implementation of an accumulator. Takes an integer and increments the internal counter by that amount. Returns current counter state."
[n] (swap! acc + n) acc)
@bitops
bitops / beer.txt
Created December 27, 2011 16:08
The Beer-Ware License
**THE BEER-WARE LICENSE**
<author> wrote this file. As long as you retain this notice youcan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.
License originally authored by Poul-Henning Kamp (phk).