Monday 26 December 2011

Greasemonkey UserScript

// ==UserScript==
// @name           test
// @namespace      test
// @include        http://www.facebook.com/johnny.k.sunny
// @exclude        
// ==/UserScript==



document.getElementById('headerArea').innerHTML = 'Life is out!';

Monday 19 December 2011

Wednesday 7 December 2011

js

var classicModulePattern = function(){
var privateVar = 1;
function privateFunction(){
alert('private');
}
return {
publicVar:2,
publicFunction:function(){
classicModulePattern.anotherPublicFunction();
},
anotherPublicFunction:function(){
privateFunction();
}
}
}();
classicModulePattern.publicFunction();
 
 
 
 
http://christianheilmann.com/2008/02/07/five-things-to-do-to-a-script-before-handing-it-over-to-the-next-developer/ 

font: 12px/18px "Monaco","Courier New","Courier",monospace; }

drop-in-modals #3 (line 181)

deep linking

http://www.thetutorialblog.com/demos/jQueryDeepLinking/#/test2

Tuesday 6 December 2011

animate css

http://daneden.me/animate/slider/

css3 rebbons

 h1{
        text-align: center;
        position: relative;
        color: #fff;
        margin: 0 -30px 30px -30px;
        padding: 10px 0;
        text-shadow: 0 1px rgba(0,0,0,.8);
        background: #5c5c5c;
        background-image: -moz-linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
        background-image: -webkit-linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
        background-image: -o-linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
        background-image: -ms-linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
        background-image:  linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
        -moz-box-shadow: 0 2px 0 rgba(0,0,0,.3);
        -webkit-box-shadow: 0 2px 0 rgba(0,0,0,.3);
        box-shadow: 0 2px 0 rgba(0,0,0,.3);
    }

    h1:before, h1:after
    {
        content: '';
        position: absolute;
        border-style: solid;
        border-color: transparent;
        bottom: -10px;
    }

    h1:before
    {
        border-width: 0 10px 10px 0;
        border-right-color: #222;
        left: 0;
    }

    h1:after
    {
        border-width: 0 0 10px 10px;
        border-left-color: #222;
        right: 0;
    }

php debuging

echo "<pre>";
var_dump(get_defined_vars());
exit;

grid system layout / template

http://960.gs/


http://grids.heroku.com/

Monday 5 December 2011

css3 buttons

http://hellohappy.org/css3-buttons/CSS - http://hellohappy.org/css3-buttons/

Collapse All
Expand All

http://hellohappy.org/css3-buttons/
http://hellohappy.org/css3-buttons/css/buttons.css
http://www.webdesignerwall.com/demo/css-buttons.html


http://tutorialzine.com/

jquery slider

http://jqueryfordesigners.com/demo/simple-spy.html


http://janne.aukia.com/zoomooz/

Sunday 4 December 2011

url clean

def clean(string)
  string = string.strip
  string = string.tr(' ', '_')
  string = string.tr("'", "")
  string = string.tr("$", "")
  string = string.tr("&", "")
  string = string.tr("<", "")
  string = string.tr(">", "")
  string = string.tr("*", "")
  string = string.tr("@", "")
  string = string.tr(".", "")
  string = string.tr(":", "")
  string = string.tr("|", "")
  string = string.tr("~", "")
  string = string.tr("`", "")
  string = string.tr("(", "")
  string = string.tr(")", "")
  string = string.tr("%", "")
  string = string.tr("#", "")
  string = string.tr("^", "")
  string = string.tr("?", "")
  string = string.tr("/", "")
  string = string.tr("{", "")
  string = string.tr("}", "")
  string = string.tr(",", "")
  string = string.tr(";", "")
  string = string.tr("!", "")
  string = string.tr("+", "")
  string = string.tr("=", "")
  string = string.tr("-", "_")
end




ruby arrays

ruby arraysArrays are ordered, integer-indexed collections of any object. Array indexing starts at 0, as in C# or Java. A negative index is assumed to be relative to the end of the array-that is, an index of -1 indicates the last element of the array, -2 is the next to last element in the array, and so on.

Creating a new array

array = Array.new
# or
array = []

Adding array elements By position

array = []
array[0] = "first element"

To the end

array << "last element"
# This adds "last element" to the end of the array
# or
array.push("last element")
# This adds "last element" to the end of the array

To the beginning

array = ["first element", "second element"]
array.unshift("before first element")
# This adds "before first element" to the beginning of the array

Retrieving array elements

By position

array = ["first element", "second element", "third element"]
third_element = array[2]
# This returns the third element.

By positions

second_and_third_element = array[1, 2]
# This returns a new array that contains the second & third elements

Removing array elements

From the beginning

array = ["first element", "second element"]
first_element = array.shift
# This removes "first element" from the beginning of the array

From the end

last_element = array.pop
# This removes "second element" or the last element from the end of the array

Combining arrays

To a new array

array = [1, 2, 3]
array.concat([4, 5, 6, 7])
[1, 2, 3, 4, 5, 6, 7]
#or
new_array = array + [4, 5, 6]
# Using the "+" method returns a new array, but does not modify the original array

Modifying the array

array.replace([4, 5, 6])
[4, 5, 6]

Pairing items

array = [1, 2, 3]
new_paired_array = array.zip([4, 5, 6])
[[1,4],[2, 5],[3, 6]]
# This creates an array of arrays

Flattening array of arrays

array = [1, 2, 3]
new_paired_array_flattened = array.zip([4, 5, 6]).flatten
[1, 4, 2, 5, 3, 6]
This flattens the arrays of arrays into one Array.

Collecting array elements

array = [1, 2, 3]
array.collect {|x| x * 2 }
[2, 4, 6]
Invokes block once for each element of self. Creates a new array containing the values returned by the block.

Iterating over arrays

[1, 2, 3, 4] .each {|x| puts x}
1
2
3
4

Filtering arrays

[1, 2, 3, 4, 5, 6] .find {|x| puts x > 5}
This returns the first element that matches the block criteria.

Querying arrays

array.find_all {|item| criteria }
This returns a new array containing all the elements of the array that match the block criteria.
array.size
This returns the number of elements in the array.
array.empty?
This returns true if the array is empty; false otherwise.
array.include?(item)
This returns true if the array contains the item; false otherwise.
array.any? {|item| criteria }
This returns true if any item in the array matches the block criteria; false otherwise.
array.all? {|item| criteria }
This returns true if all items in the array match the block criteria; false otherwise
Hopefully if you are new to the Ruby or you have been doing some Rails work but have not really dug into Ruby, this very basic overview will spark deeper interest into the powerful (and very fun) world of Ruby.
http://carlosgabaldon.com/ruby/ruby-arrays/

books

osx tools

http://carlosgabaldon.com/2010/05/30/rubyist-os-x-dev-setup/

Rails Common Commands

rvm ruby-1.9.2-p0 - ruby version manager; switches to Ruby 1.9.2
rvm --default ruby-1.9.2-p0 - ruby version manager; sets 1.9.2 as default
rvm system - ruby version manager; switches to Ruby 1.87
rails new - creates a new Rails application
rails server [s] - launches WEBrick web server
rails generate [g] - lists available generators
rails generate controller --help - provides usage documentation
rails generate model --help - provides usage documentation
rails generate migration --help - provides usage documentation
rails destroy controller [Name] - undo generate controller
rails destroy model [Name] - undo generate model
rails generate scaffold [Name] --skip --no-migration - scaffold skipping existing files
rake db:migrate - runs database migrations
rake db:test:clone - clones current environment's database schema
rake db:test:purge - empties the test database
rake routes - list of all of the available routes
rake -T - list of rake commands
git init - creates git repo
git add . - adds all files to working tree
git commit -m "Initial commit" - commits files to repo
git status - status of the working tree
git push origin master - merges local repo with remote
git checkout -b new-dev - creates topic branch
git checkout master - switches to master branch
git merge new-dev - merges new-dev branch into master branch
git checkout -f - undo uncommitted changes on working tree
git branch - list branches
git branch -d modify-README - deletes branch
git mv README README.markdown - renames files using move command
heroku create - creates app on Heroku servers
git push heroku master - pushs app on to Heroku servers
heroku rake db:migrate - runs database migrations on Heroku servers
heroku pg:reset --db SHARED_DATABASE_URL - deletes database file
heroku db:push - transfer an existing database to Heroku.
rails console - command line interface to Rails app
rails dbconsole - command line database interface
bundle install - installs gems from Gemfile

a nice sinatra tutorial

http://carlosgabaldon.com/ruby/singing-with-sinatra/

Compass CSS Authoring Framework.

http://compass-style.org/install/

Sintra quick realod on request

require 'rubygems'
require 'sinatra'

configure :development do
Sinatra::Application.reset!
use Rack::Reloader
end