Skip to content

Instantly share code, notes, and snippets.

View RaVbaker's full-sized avatar
drinking coffee

Rafal Piekarski RaVbaker

drinking coffee
View GitHub Profile
@RaVbaker
RaVbaker / gist:6233181
Created August 14, 2013 17:14
[PHP] klasa do obsługi API Ceneo
<?php
/*
* Author: Rafał "RaVbaker" Piekarski <ravbaker @ gmail.com>
* Website: http://ravbaker.net/
* License: MIT
* Created in: 2013
*/
class CeneoApi {
@RaVbaker
RaVbaker / gist:4985071
Created February 19, 2013 11:36
[HOWTO] Setting up a Ruby on Rails development environment on Mountain Lion

Setting up a Ruby on Rails development environment on Mountain Lion

Having just installed Mountain Lion on my MBA, I encounted a few small problems while trying to install RVM as well as Ruby, etc. Below are the steps I took to get Ruby on Rails up and running on my new Mountain Lion install.

  • Step 1. Install XCode (this isn't required but it's best to install it)

  • Step 2. Install the XCode Command Line Tools from developer.apple.com. Note you need to download the 10.8 command line tools which is at the bottom of the list on XCode 4.4. I made the mistake of downloading the 10.7 Lion set first!

  • Step 3. Install XQuartz

@RaVbaker
RaVbaker / gist:3894177
Created October 15, 2012 18:27 — forked from demimismo/gist:3359506
Install Postgresql on Mountain Lion

Install Postgresql on Mountain Lion

Based on: http://coderwall.com/p/1mni7w

brew install postgresql
initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
@RaVbaker
RaVbaker / gadget.xml
Created October 11, 2012 20:29
igoogle gadget test
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Hello World!" />
<Content type="html">
<![CDATA[
Hello, world!
]]>
</Content>
</Module>​
@RaVbaker
RaVbaker / gist:2967695
Created June 21, 2012 18:44
[HOWTO] Ubuntu 12.04 Ruby on Rails Development Environment

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade
@RaVbaker
RaVbaker / ruby-1.9-tips.rb
Created June 17, 2012 13:51 — forked from igrigorik/ruby-1.9-tips.rb
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@RaVbaker
RaVbaker / fetch_all.rb
Created June 5, 2012 20:34
YouTube Videos downloader
#!/usr/bin/env ruby -wKU
#### script requires wget app
# Copyright RaVbaker - MIT license
# list of video urls, each url in single line
videos = %w{
http://www.youtube.com/watch?v=lFJey0tOvBg
http://www.youtube.com/watch?v=HAtsUpBlnf8
http://www.youtube.com/watch?v=V6eHKcZkDtg
@RaVbaker
RaVbaker / bookmarklet.js
Created May 29, 2012 12:06
hover on iOS testing
javascript:(function(){var jsCode=document.createElement('script');jsCode.setAttribute('src','https://raw.github.com/gist/2828079/hover.js');document.body.appendChild(jsCode);}());
@RaVbaker
RaVbaker / readme.md
Last active October 23, 2019 15:27
[HOWTO] Forward ports a.k.a. make SSH Tunneling

Syntax:

ssh -L localport:host:hostport user@ssh_server -N 

where:

  • -L - port forwarding parameters (see below)
  • localport - local port (chose a port that is not in use by other service)
  • host - server that has the port (hostport) that you want to forward
  • hostport - remote port
@RaVbaker
RaVbaker / readme.md
Created March 30, 2012 20:12
[HOWTO] Rewrite all urls to one index.php in Apache

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d