Skip to content

Instantly share code, notes, and snippets.

@pfleidi
pfleidi / fiberchat.rb
Created February 19, 2011 18:51
A naive socket chat using select() and ruby fibers
require 'rubygems'
require 'socket'
include Socket::Constants
class ChatServer
def initialize
@reading = Array.new
@writing = Array.new
@clients = Hash.new
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@agnoster
agnoster / README.md
Last active September 25, 2024 09:27
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@afeld
afeld / gist:5704079
Last active November 15, 2024 15:57
Using Rails+Bower on Heroku
@clyfe
clyfe / simple_form.rb
Created August 22, 2013 08:20
Bootstrap3 compatible simple_form initializer
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
# https://github.com/plataformatec/simple_form/issues/316
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
@tokenvolt
tokenvolt / simple_form_bootstrap3.rb
Last active November 2, 2023 11:55
Bootstrap 3 simple form initializer
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
@tcnksm
tcnksm / docker_cheat.md
Last active August 5, 2021 03:59 — forked from wsargent/docker_cheat.md
Docker 虎の巻

Docker 虎の巻

何故Dockerを使うべきか

Why Should I Care (For Developers)

"Dockerが面白いのはシンプルな環境に隔離性と再現性をもたらしてくれることだ.ランタイムの環境を一度作れば、パッケージにして別のマシンでも再利用することできる.さらに,すべてはホスト内の隔離された環境で行われる(VMのように).最も素晴らしい点は,シンプルかつ高速であることだ."

@mjul
mjul / form_to_opencv.py
Created July 2, 2014 19:27
Decode Python (Flask or Werkzeug) photo file uploaded via HTTP POST request in-memory to an OpenCV matrix.
#
# Example from code built on the Flask web framework (and Werkzeug)
# Accepts uploading a photo file in the 'photo' form member, then
# copies it into a memory byte array and converts it to a numpy array
# which in turn can be decoded by OpenCV.
#
# Beware that this increases the memory pressure and you should
# configure a max request size before doing so.
#
# It saves a round-trip to a temporary file, though.
@tobiassteenweg
tobiassteenweg / String+EncodeURIComponent.swift
Created July 25, 2015 11:18
encodeURIComponent() in swift
extension String {
func encodeURIComponent() -> String? {
var characterSet = NSMutableCharacterSet.alphanumericCharacterSet()
characterSet.addCharactersInString("-_.!~*'()")
return self.stringByAddingPercentEncodingWithAllowedCharacters(characterSet)
}
}