# in Gemfile
gem 'rails', '3.1.1'
gem 'haml'
gem 'haml-rails', :group => :development
This file contains 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
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
This file contains 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 screen_shot_and_save_page | |
require 'capybara/util/save_and_open_page' | |
path = "/#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}" | |
Capybara.save_page body, "#{path}.html" | |
page.driver.render Rails.root.join "#{Capybara.save_and_open_page_path}" "#{path}.png" | |
end | |
begin | |
After do |scenario| | |
screen_shot_and_save_page if scenario.failed? |
This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.
Huge thanks to funny-falcon for the performance patches.
This file contains 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
# Launch Pry with access to the entire Rails stack. | |
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead. | |
# If you don't, you can load it through the lines below :) | |
rails = File.join Dir.getwd, 'config', 'environment.rb' | |
if File.exist?(rails) && ENV['SKIP_RAILS'].nil? | |
require rails | |
if Rails.version[0..0] == "2" | |
require 'console_app' |
#Quiz:
-
What’s the result of:
console.log(f()); function f() { return 1; }
Answers:
#Quiz:
-
What’s the result of:
function A() {} A.prototype.name = 'A'; var a = new A(); var b = new A();
This file contains 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
# | |
# A CORS (Cross-Origin Resouce Sharing) config for nginx | |
# | |
# == Purpose | |
# | |
# This nginx configuration enables CORS requests in the following way: | |
# - enables CORS just for origins on a whitelist specified by a regular expression | |
# - CORS preflight request (OPTIONS) are responded immediately | |
# - Access-Control-Allow-Credentials=true for GET and POST requests |
OlderNewer