This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# objective-j & ruby comparison - Methods | |
@implementation Person:CPObject | |
{ | |
CPString name; | |
-(void) setName: (CPString)aName | |
{ | |
name=aName; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# objective-j | |
@implementation Person : CPObject | |
{ | |
CPString name; | |
} | |
@end | |
# ruby | |
class Person < CPObject | |
attr_reader :namer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def robot_internals | |
arm = "mechanical hydraulics" | |
return binding | |
end | |
binded = robot_internals | |
arm = "five fingers" | |
eval "puts arm" # five fingers | |
eval "puts arm", binded # mechanical hydraulics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Robots with class_eval | |
class Robot | |
end | |
def add_machinegun_to_robots | |
Robot.class_eval %Q( | |
def machine_guns | |
p "I'm loaded with machine gun" | |
end | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Project has many Tasks | |
Tasks belongs to Project | |
Tables: | |
projects [id, name, date] | |
tasks [id, description, project_id] | |
*/ | |
class Project extends AppModel { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! put in ~/.xmodmap | |
! Swap Caps_Lock and Control_L | |
! | |
remove Lock = Caps_Lock | |
remove Control = Control_L | |
keysym Control_L = Caps_Lock | |
keysym Caps_Lock = Control_L | |
add Lock = Caps_Lock | |
add Control = Control_L |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ckfinder/config.php | |
session_name("CAKEPHP"); | |
session_start(); | |
function CheckAuthentication() | |
{ | |
if(isset($_SESSION['Auth']['User'])){ | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Warning - 2AM Work! | |
# I'm too lazy for better approach (and too sleepy) | |
@newgems = [] | |
strips = [".", ",", "(", ")"] | |
(0..9).to_a.each{ |x| strips << x.to_s } | |
File.open "gems", "r" do |f| | |
f.each do |line| | |
strips.each{|x| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'simpletest/autorun.php'; | |
function add($a, $b){ | |
return $a + $b; | |
} | |
function sayHi($name){ | |
return "Hello $name"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# apply to application_controller.rb | |
# add to before_filter | |
before_filter ....., :remove_sign_in_layout | |
def remove_sign_in_layout | |
if params[:controller] == 'devise/sessions' | |
render :layout => nil | |
end |
OlderNewer