Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcin Kulik sickill

View GitHub Profile
View test-runner.cljs
Running ClojureScript test: test
Loading URL: env/test/unit-test.html
Running test.
Testing player.view-test
FAIL in (fg-color-test) (:)
expected: (= (v/fg-color 1 false) 111)
actual: (not (= 1 111))
View gist:05c31e7fe98e20af8993
(deftest changes-at-test
(let [frames [[2 :a] [4 :b] [6 :c]]]
(is (= (changes-at frames 0) nil))
(is (= (changes-at frames 1) nil))
(is (= (changes-at frames 2) :a))
(is (= (changes-at frames 3) :a))
(is (= (changes-at frames 4) :a))
(is (= (changes-at frames 5) :a))
(is (= (changes-at frames 6) :b))
(is (= (changes-at frames 7) :b))
@sickill
sickill / asciinema.yml
Created Jun 23, 2015
asciinema site config file
View asciinema.yml
smtp_settings:
:address: "smtp.gmail.com"
:port: 587
:enable_starttls_auto: true
:user_name: "joe@gmail.com"
:password: "8s7df7syfysu"
:authentication: :plain
:domain: "gmail.com"
@sickill
sickill / play.rb
Last active Aug 29, 2015
The simplest asciicast player
View play.rb
# This plays asciicast (v1 format - https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v1.md) in your terminal:
# ruby play.rb asciicast.json
require 'json'
JSON.parse(File.read(ARGV[0]))['stdout'].each do |frame|
sleep frame[0]
STDOUT.write frame[1]
STDOUT.flush
end
View rack-tidy-output.txt
lenny ~/workspace/rack-tidy % ruby app.rb
== Sinatra/0.9.1.1 has taken the stage on 4567 for development with backup from Mongrel
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 60 - Warning: discarding unexpected </div>
Info: Document content looks like HTML 3.2
2 warnings, 0 errors were found!
127.0.0.1 - - [08/May/2009 20:58:07] "GET / HTTP/1.1" 200 79 0.0054
View rack-tidy.rb
require 'rubygems'
require 'tidy'
require 'sinatra'
module Rack
class Tidy
def initialize(app)
@app = app
::Tidy.path = "/usr/lib/libtidy-0.99.so.0" # or "/usr/lib/libtidy.A.dylib" on Mac
end
View quicksort.rb
class Array
def qsort
return self if empty?
select { |x| x < first }.qsort + [first] + select { |x| x > first }.qsort
end
end
View gist:131538
require 'ruby2ruby'
$q = []
def queue_code(args={}, &blk)
(c = Class.new).class_eval { define_method :proc, blk }
$q << { :code => Ruby2Ruby.translate(c, :proc), :args => args }
end
def run_all_queued
View gist:144376
# $Id: PKGBUILD,v 1.36 2009/06/22 13:09:26 sergej Exp $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Miroslaw Szot <mss@czlug.icis.pcz.pl>
_doc_root=/srv/http/nginx
_server_root=/etc/nginx
_conf_path=${_server_root}/conf
_tmp_path=/var/spool/nginx
_log_path=/var/log/nginx
_user=http
View gist:144375
# $Id: PKGBUILD,v 1.36 2009/06/22 13:09:26 sergej Exp $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Miroslaw Szot <mss@czlug.icis.pcz.pl>
_doc_root=/srv/http/nginx
_server_root=/etc/nginx
_conf_path=${_server_root}/conf
_tmp_path=/var/spool/nginx
_log_path=/var/log/nginx
_user=http