Skip to content

Instantly share code, notes, and snippets.

View rn0's full-sized avatar
:bowtie:
testing

Piotr Kapera rn0

:bowtie:
testing
View GitHub Profile
@rn0
rn0 / README.markdown
Created April 3, 2012 17:40 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@rn0
rn0 / bootstrap-grid.css
Created March 3, 2012 19:36 — forked from abitgone/bootstrap-grid.css
Grid Overlay for Twitter Bootstrap
/*
* Grid Overlay for Twitter Bootstrap
* Assumes a 1.692em baseline grid (22px/13px)
*/
@media (min-width: 1200px) {
body {
background: -webkit-linear-gradient(
90deg,
rgba(0,0,0,0.05),
rgba(0,0,0,0.05) 4.545%,
@rn0
rn0 / form.html
Created March 1, 2012 14:31 — forked from patashnik/form.html
Forms "dynamic" validators
<form method="post">
<div>
<label>First <input type="radio" name="choice" value="1" /></label>
<input type="text" name="first_text" />
</div>
<div>
<label>Second <input type="radio" name="choice" value="2" /></label>
<input type="text" name="second_text" />
</div>
</form>
@rn0
rn0 / installation.sh
Created December 18, 2011 00:17 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@rn0
rn0 / node-and-npm-in-30-seconds.sh
Created August 20, 2011 23:14 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@rn0
rn0 / GzipFilter.php
Created August 7, 2011 20:50 — forked from timewasted/GzipFilter.php
Assetic gzip filter
<?php
namespace Assetic\Filter;
use Assetic\Asset\AssetInterface;
use Assetic\Util\ProcessBuilder;
/**
* Runs assets through gzip.
*/
# Index
---------------------------------------------------------------------
curl -XPUT http://localhost:9200/pictures/ -d '
{
"settings": {
"analysis": {
"analyzer": {
"index_analyzer": {
"tokenizer": "standard",
@rn0
rn0 / Rakefile
Created July 3, 2011 20:47 — forked from andreyvit/Rakefile
require 'rake/clean'
HAML = FileList['**/*.haml']
LESS = FileList['**/*.less']
COFFEE = FileList['**/*.coffee']
HTML = HAML.ext('html')
CSS = LESS.ext('css')
JS = COFFEE.ext('js')
require 'spec_helper'
describe User do
describe "Object Attributes" do
before(:each) { @obj = User.new }
specify { @obj.should respond_to(:first_name) }
specify { @obj.should respond_to(:last_name) }
specify { @obj.should respond_to(:login) }
end
@rn0
rn0 / application.rb
Created June 19, 2011 18:51 — forked from robertsosinski/application.rb
A simple way to manage multiple parameters in Rails routing
before_filter :hash_options
def hash_options
params[:options] = Hash[*((params[:options].size % 2) == 0) ? params[:options] : (params[:options] + [nil])] if params[:options]
end