Skip to content

Instantly share code, notes, and snippets.

View rlisowski's full-sized avatar

Rafał Lisowski rlisowski

  • Warsaw, Poland
View GitHub Profile

Download and Install Vagrant http://www.vagrantup.com/ and VirtualBox https://www.virtualbox.org/ or VMware before beginning

#Set up Vagrant *this guide assumes the use of Mac OS X Mountain Lion on local machine and Ubuntu 12.04 LTS x64 on Vagrant box. It is compatible with many other distros but hasn't been tested.

##Step 1: Make and run box

vagrant init
vagrant box add <path to box directory or name according to https://vagrantcloud.com/>
vagrant up
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.21)
actionpack (= 3.2.21)
mail (~> 2.5.4)
actionpack (3.2.21)
activemodel (= 3.2.21)
activesupport (= 3.2.21)
builder (~> 3.0.0)
Your Gemfile lists the gem mysql2 (~> 0.3.11) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem activerecord-jdbcmysql-adapter (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using multi_json 1.10.1
Using rake 10.1.1
@rlisowski
rlisowski / gist:874419
Created March 17, 2011 14:33
start rails server or console
#alias sc='script/console'
function sc (){
if [ -f ./script/rails ]
then
ruby script/rails c
elif [ -f ./script/console ]
then
ruby script/console
else
echo "nie znajdujesz się w katalogu projektu rails"
@rlisowski
rlisowski / get_images.rb
Created May 27, 2011 11:28
get images from http page
def get_images(url)
images = []
if url =~ /^.*\.(jpg|jpeg|png)$/
images << url
else
uri = URI.parse(url)
domain_with_port = "#{uri.scheme}://#{uri.host}:#{uri.port}"
doc = Hpricot(open(uri, proxy: "http://#{Settings.proxy.address}:#{Settings.proxy.port}"))
@rlisowski
rlisowski / mp3 player flowplayer
Created September 14, 2011 09:24
mp3 player flowplayer
<!DOCTYPE html>
<!--
This is Flowplayer standalone demo. The fastest way to get started.
You can freely copy things on your site. All demos can be found from:
http://flowplayer.org/demos/
Enjoy!
-->
<head>
@rlisowski
rlisowski / gist:2164702
Created March 22, 2012 21:29 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

#!/usr/bin/env ruby
class RubyArchive
require 'rubygems/package'
require 'zlib'
attr_reader :path
class Archive
@rlisowski
rlisowski / benchmark.rb
Created August 21, 2013 08:52
benchmark end_with? against regex
require 'benchmark'
n = 50000
puts "--------"
puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
10.times do |iteration|
m = n*iteration
Benchmark.bm(7) do |x|
puts "iteration: #{iteration} times: #{m}"
x.report("end_with? :") do
@rlisowski
rlisowski / cert_generator.rb
Last active December 22, 2015 05:29
generate ssl certs
# GENERATE CERTIFICATES
require 'openssl'
class CertGenerator
def self.generate
CertGenerator.new.generate
end
def generate