Skip to content

Instantly share code, notes, and snippets.

View spajus's full-sized avatar
🌴
On vacation

Tomas Varaneckas spajus

🌴
On vacation
View GitHub Profile
#routes.rb
get "blog/category/:category/" => "posts#by_category", as: :post_category
get "blog/category/:category/index.html" => "posts#by_category"
get "blog/page-:page/" => "posts#index", as: :blog
get "blog/page-:page/index.html" => "posts#index"
get "blog/:slug/" => "posts#by_slug", as: :post_slug
get "blog/:slug/index.html" => "posts#by_slug"
get "blog" => "posts#index", as: :blog
get "blog/index.html" => "posts#index"
``````````````````````````````````````````````````````````````````````......,::;;;''''''''++++++++++++++++++++++++++++'++''++++++++++++#++++#+++++++++++++++#
````````````````````````````````````````````````````````````````````````....,,::;;;'''''''++++++++++++++++++++++++++++++'''''+++++++++++++++++++++++++++++++#
````````````````````````````````````````````````````````````````````````....,,::;;;''''''''+++++++++++++++++++++++++++++'''''++++++++++++++++++'++++++++++++#
````````````````````````````````````````````````````````````````````````...,,,::;;;''''''''+++++++++++++'+++++++++++''++'''''''+''++'+++++++''''+++++++++++++
````````````````````````````````````````````````````````````````````````...,,,::;;;;''''''''+++++++++''+'+++++''++''''''''''''''''''''+''+++'''''++++++++++++
``````````````````````````````````````````````````````````````````````````..,,:::;;;;;;;'''''''++'''''''''''''''''''''''''''''''+''''''''''+''''''''''''+++++
```````````````````````````````````````````````````````````````````````````.
@spajus
spajus / gist:5213420
Created March 21, 2013 14:26
delete all git tags locally and remotely with exclusion list
for t in `git tag`
do
arr=("keep_this" "keep_that" "and this")
if [[ "${arr[@]}" =~ ${t} ]]; then
echo keeping $t
else
git push origin :$t
git tag -d $t
fi
done
{ "action": "closed", "number": 1, "pull_request": { "_links": { "comments": { "href": "https://api.github.com/repos/spajus/dailyscripts/issues/1/comments" }, "html": { "href": "https://github.com/spajus/dailyscripts/pull/1" }, "issue": { "href": "https://api.github.com/repos/spajus/dailyscripts/issues/1" }, "review_comments": { "href": "https://api.github.com/repos/spajus/dailyscripts/pulls/1/comments" }, "self": { "href": "https://api.github.com/repos/spajus/dailyscripts/pulls/1" } }, "additions": 6, "assignee": null, "base": { "label": "spajus:master", "ref": "master", "repo": { "archive_url": "https://api.github.com/repos/spajus/dailyscripts/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/spajus/dailyscripts/assignees{/user}", "blobs_url": "https://api.github.com/repos/spajus/dailyscripts/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/spajus/dailyscripts/branches{/branch}", "clone_url": "https://github.com/spajus/dailyscripts.git", "collaborators_url": "https://api
vars = Object.methods
Benchmark.realtime { 100000.times { vars.map { |var| var.to_s } } }
=> 2.04459
Benchmark.realtime { 100000.times { vars.map { |var| var.to_s } } }
=> 2.048889
Benchmark.realtime { 100000.times { vars.map(&:to_s) } }
=> 1.917303
Benchmark.realtime { 100000.times { vars.map(&:to_s) } }
=> 1.944543
Index: configure.ac
===================================================================
--- configure.ac (revision 13700)
+++ configure.ac (working copy)
@@ -346,6 +346,12 @@
DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
;;
+ 13.*)
+ AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
#!/usr/bin/env ruby
require 'glusterfs'
50.times do
volume = GlusterFS::Volume.new('dist-volume')
volume.mount('distfs')
volume.unmount
_, size = `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i)
puts "Mem usage: #{size}"
end
require 'singleton'
require 'gosu'
class TestGameWindow < Gosu::Window
include Singleton
def initialize
super(640, 480, false)
self.caption = "Esc = quit"
end
class Player
def draw
@sprite.draw(@x, @y, 0) # Gosu::Image
# is there any way to find out value of @x and @y after all transformations it will go through?
end
end
class GameWindow < Gosu::Window
def draw
transform(@cam_x, @cam_y) do
scale(@cam_zoom_x, @cam_zoom_y, @cam_x, @cam_y) do
stack level too deep
/Users/spajus/Dropbox/rubygamedev/manuscript/code/09-polishing/game_window.rb:11:in `update'
/Library/Ruby/Gems/2.0.0/gems/gosu-0.7.50/lib/gosu/swig_patches.rb:15:in `block (2 levels) in <class:Window>'
/Library/Ruby/Gems/2.0.0/gems/gosu-0.7.50/lib/gosu/swig_patches.rb:37:in `show'
/Library/Ruby/Gems/2.0.0/gems/gosu-0.7.50/lib/gosu/swig_patches.rb:37:in `show'
09-polishing/main.rb:28:in `<main>'