This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.highlight { background-color: #49483e } | |
.c { color: #75715e } /* Comment */ | |
.err { color: #960050; background-color: #1e0010 } /* Error */ | |
.k { color: #66d9ef } /* Keyword */ | |
.l { color: #ae81ff } /* Literal */ | |
.n { color: #f8f8f2 } /* Name */ | |
.o { color: #f92672 } /* Operator */ | |
.p { color: #f8f8f2 } /* Punctuation */ | |
.cm { color: #75715e } /* Comment.Multiline */ | |
.cp { color: #75715e } /* Comment.Preproc */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TestRocket is a simple, tiny testing library for Ruby 1.9. | |
If => in a hash is a "hash rocket", then +-> and --> for tests should be | |
"test rockets"! | |
Simple syntax: | |
+-> { block that should succeed } | |
--> { block that should fail } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### The 4 unaries are: + - ~ ! | |
### If you really found more, tell me ;o) | |
class Foo | |
def +@ | |
puts "unary plus (in front of object) / without param" | |
end | |
def -@(a=42) | |
# please tell me, how could I pass an argument to an unary operation? | |
# but it's possible to define arguments, curious ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
# We are not loading Active Record, nor the Assets Pipeline, etc. | |
# This could also be in your Gemfile. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
# The following lines should come as no surprise. Except by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# input data | |
sort = [ 3, 1, 4, 2 ] | |
ary = [ :a, :b, :c, :d ] | |
# the index value should be in result, too (with id+1 because they can be DB indices) | |
### sort array represents **position** of item in `ary` | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App = lambda do |env| | |
[ | |
200, | |
{ "Content-Type" => "text/plain" }, | |
[ | |
"Hello!\n", | |
"self in config.ru is: #{RACK_BUILDER.to_s}\n", | |
"@use = #{RACK_BUILDER.instance_variable_get(:@use)}\n", | |
"@map = #{RACK_BUILDER.instance_variable_get(:@map)}\n", | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# .git/hooks/pre-commit | |
# | |
# NEEDS registered version of Balsamiq Mockups (mandatory for PNG export) | |
# | |
# Exports *.bmml files to PNGs, but only for new or modified ones (files in stage area). | |
# This should be installed as .git/hooks/pre-commit in your local repository (with +x flag). | |
# As git hook it ensures that your new/modified (and staged) files will be exported before commit | |
# your changes to the repository automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
# Count lines of multiple files (recursively): | |
find source_dir -name "*.ext" -exec wc -l {} + | |
# 7 digit sha1 transformed timestamp name: | |
### simple: date +%s%N | \ | |
### more unique | |
/usr/lib/systemd/systemd-timestamp | \ | |
sha1sum | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(date_util). | |
-compile(export_all). | |
epoch() -> | |
now_to_seconds(now()) | |
. | |
epoch_hires() -> | |
now_to_seconds_hires(now()) | |
. |
OlderNewer