Skip to content

Instantly share code, notes, and snippets.

View changs's full-sized avatar
💭
I may be slow to respond.

Bartosz Pranczke changs

💭
I may be slow to respond.
View GitHub Profile
@changs
changs / gist:1022659
Created June 13, 2011 11:54
Strace Virtualbox
8032 execve("/usr/lib/virtualbox/VirtualBox", ["/usr/lib/virtualbox/VirtualBox"], [/* 148 vars */]) = 0
8030 brk(0) = 0x1486000
8030 fcntl(0, F_GETFD) = 0
8030 fcntl(1, F_GETFD) = 0
8030 fcntl(2, F_GETFD) = 0
8030 access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
8030 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0556ac3000
8030 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
8030 open("/etc/ld.so.cache", O_RDONLY) = 3
8030 fstat(3, {st_mode=S_IFREG|0644, st_size=94091, ...}) = 0
before_filter :pre_cors
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
headers['Access-Control-Max-Age'] = "1728000"
end
def pre_cors
@changs
changs / .zshrc
Created June 25, 2012 09:06
ESC-i to put git commit -am "[#pivotal_id_from_clipboard]
function git_commit() {
cmd='git commit -am "[#'
space=' "'
BUFFER=$cmd$(pbpaste)]$space
zle get-line
zle end-of-line
zle backward-char
}
zle -N git_commit
bindkey "^[i" git_commit
@changs
changs / robot.js
Created December 4, 2012 16:39
Dominator
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot;
robot = ev.robot;
rvm get head
brew install autoconf automake
rvm uninstall 1.9.3-p327
rvm cleanup sources
rvm install 1.9.3-p327 --patch falcon
rvm reload
bundle
gem pristine --all
@changs
changs / add_show_output_from_server.patch
Created January 10, 2014 15:52
Add to AB the ability to show response from server for every request.
diff --git a/ab.c b/ab.c
index 5a6f2a0..c1c88a5 100644
--- a/ab.c
+++ b/ab.c
@@ -262,6 +262,7 @@ struct data {
/* --------------------- GLOBALS ---------------------------- */
int verbosity = 0; /* no verbosity by default */
+int show_response = 0; /* non-zero to show server response to every request */
int recverrok = 0; /* ok to proceed after socket receive errors */
@changs
changs / -
Created April 18, 2014 10:38
diff --git a/app/controllers/shops_controller.rb b/app/controllers/shops_controller.rb
index dff3678..16d99e1 100644
--- a/app/controllers/shops_controller.rb
+++ b/app/controllers/shops_controller.rb
@@ -20,7 +20,7 @@ class ShopsController < ApplicationController
def show
respond_to do |format|
- format.json { render :json => ApiShop.find_by_id(params[:id], current_user.meez_name), :content_type => "application/json" }
+ format.json { render :json => ApiShop.find_by_id_and_gender(params[:id], params[:gender]), :content_type => "application/json" }
@changs
changs / -
Last active August 29, 2015 14:01
You're using: resque-rollbar 0.0.1. The latest version is 0.0.4
You're using: nvd3-rails 0.0.1. The latest version is 0.0.1.1
You're using: activerecord-import 0.4.1. The latest version is 0.5.0
You're using: bootstrap-wysihtml5-rails 0.3.1.21. The latest version is 0.3.1.24
You're using: shopify-mock 0.1.4. The latest version is 0.1.2
You're using: omniauth-bigcommerce 0.2.0. The latest version is
You're using: premailer-rails 1.4.0. The latest version is 1.7.0
You're using: netguru 0.0.7.13. The latest version is
You're using: jquery-datatables-rails 1.11.2. The latest version is 1.12.2
You're using: geckoboard-push 0.1.2. The latest version is 0.1.0
[{"A_mcapp"=>
{"*.inline"=>
{:provider=>"test",
:tags=>
{"id"=>"MZ_300x600_AUDIO_ON",
"div_id"=>"1384374491540-4",
"_type"=>"inline"},
:size=>"300x250"},
"home.inline"=>
{:provider=>"propel",
git_commit() {
cmd='git commit -am "[#'
space=' "'
BUFFER=$cmd$(pbpaste)]$space
zle get-line
zle end-of-line
zle backward-char
}
zle -N git_commit