Skip to content

Instantly share code, notes, and snippets.

View Zhomart's full-sized avatar
🏠
Working from home

Zhomart Mukhamejanov Zhomart

🏠
Working from home
View GitHub Profile

in QuestionsController

if @question.set(:deleted => true)
  flash[:notice] = render partial: 'notice_undo_delete_question'

  redirect_to :back
else
  render :edit
end
def create
raise "I'm here"
build_resource
if resource.save
// resource is your user
@facebookdata = resource.facebook_data.new
@facebookdata.likes = "likes"
class User < ActiveRecord::Base
# here use after create callback
# http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
after_create :create_facebookdata
def create_facebookdata
# do some stuff here
self.facebookdata = Facebookdata.new
self.facebookdata.save!
end
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
#[[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && source $HOME/.tmuxinator/scripts/tmuxinator
alias rspec='rspec --color --tty --format doc'
export EDITOR=vim
doctype
html
head
title Slim is FUN
meta charset="utf-8"
body
#header
h1 Cool... header
#container
#content
@Zhomart
Zhomart / gist:5677587
Last active December 17, 2015 21:49
apache bench result
Total: connections 27000 requests 26701 replies 26701 test-duration 179.996 s
Connection rate: 150.0 conn/s (6.7 ms/conn, <=47 concurrent connections)
Connection time [ms]: min 1.1 avg 5.0 max 315.0 median 2.5 stddev 13.0
Connection time [ms]: connect 0.3
Request rate: 148.3 req/s (6.7 ms/req)
Request size [B]: 72.0
Reply rate [replies/s]: min 139.8 avg 148.3 max 150.3 stddev 2.7 (36 samples)
@Zhomart
Zhomart / gist:5682694
Created May 31, 2013 02:50
apache bench
Server Software: thin
Server Hostname: localhost
Server Port: 80
Document Path: /students
Document Length: 1204 bytes
Concurrency Level: 1
Time taken for tests: 2.371 seconds
Complete requests: 1000
# 2ch image saver written on ruby.
# create list.txt and put thread url on each line
# sample:
#
# $ cat list.txt
# http://2ch.hk/aa/res/55017.html
# http://2ch.hk/aa/res/22059.html
# http://2ch.hk/aa/res/40624.html
# http://2ch.hk/aa/res/51504.html
$ ab -n 5000 -c 40 http://33467.cirkl.me/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 33467.cirkl.me (be patient)
...................
Finished 5000 requests
@Zhomart
Zhomart / gist:6492642
Created September 9, 2013 07:54
benchmarking of indiegogo.com
ab -n 1000 -c 40 http://www.indiegogo.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.indiegogo.com (be patient)
.....
Finished 1000 requests