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
$sessions = {} | |
class Test | |
def initialize(session, &blk) | |
$last_session = session | |
yield | |
end | |
end | |
class User | |
def initialize |
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
menu = Menu.new | |
menu << 'Quit' do | |
$app.quit | |
end | |
#this appends a menu item 'Quit' which exits the application when clicked |
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
foo << 'bar' do | |
something | |
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
1. Download and install Qt SDK 4.8 (http://qt.nokia.com/downloads/) | |
2. Build Smokegen (https://projects.kde.org/projects/kde/kdebindings/smoke/smokegen/repository) | |
3. Build Smokeqt (https://projects.kde.org/projects/kde/kdebindings/smoke/smokeqt/repository) | |
4. Build (https://projects.kde.org/projects/kde/kdebindings/ruby/qtruby/repository) |
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
class Contacts::ApplicationController | |
respond_to :json, :html | |
def index | |
respond_with Contacts.all | |
end | |
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
has_and_belongs_to_many :followers, | |
class_name: 'User', | |
foreign_key: 'follower_id', | |
join_table: 'followers_followees' | |
has_and_belongs_to_many :followees, | |
class_name: 'User', | |
foreign_key: 'followee_id', | |
join_table: 'followers_followees' |
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
require 'sinatra' | |
require 'haml' | |
get '/hi/:variable' do | |
@variable = params[:variable] | |
haml :template_file | |
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
from flask import Flask | |
from flask import render_template | |
app = Flask(__name__) | |
@app.route("/dashboard/<variable>") | |
def dashboard(): | |
return render_template('template_file.html', variable=variable) | |
if __name__ == "__main__": |
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
[root@speedy dennis]# parted /dev/sda p free | |
Model: ATA Hitachi HTS54321 (scsi) | |
Disk /dev/sda: 160GB | |
Sector size (logical/physical): 512B/512B | |
Partition Table: msdos | |
Number Start End Size Type File system Flags | |
1 32.3kB 32.3GB 32.3GB primary boot | |
32.3GB 33.4GB 1081MB Free Space | |
3 33.4GB 160GB 127GB extended |
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
class Array | |
def to_proc | |
lambda { |o| o.__send__(first, *self[1..-1]) } | |
end | |
end | |
1.9.3-p0 :031 > [1,2,3].map(&[:+, 1]) | |
=> [2, 3, 4] | |