Skip to content

Instantly share code, notes, and snippets.

View danielberkompas's full-sized avatar

Daniel Berkompas danielberkompas

View GitHub Profile
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,
# configuration for osx clipboard support
set-option -g default-command "reattach-to-user-namespace -l sh"

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
def pbcopy(str)
IO.popen('pbcopy', 'r+') {|io| io.puts str }
output.puts "-- Copy to clipboard --\n#{str}"
end
Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n|
pbcopy _pry_.input_array[n ? n.to_i : -1]
end
Pry.config.commands.command "copy", "Copy to clipboard" do |str|
require 'active_record'
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Schema.define(:version => 1) do
create_table :posts do |t|
t.string :title
t.timestamps
end
end