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
# csv_import_users.rake | |
# Bulk user provisioning for Redmine using CSV file | |
# Copyright (C) 2010 - Adrian Perez <adrianperez.deb@gmail.com> | |
# Licensed under GPL 3. | |
require 'csv' | |
namespace :redmine do | |
task :csv_import_users => :environment do | |
@first_row = true |
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
class String | |
def method_missing(name, *args, &block) | |
name == :ghost_capitalize ? capitalize : super | |
end | |
end | |
require 'benchmark' | |
Benchmark.bmbm do |b| | |
b.report "Normal method" do | |
1_000_000.times { "abc".capitalize } |
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
jQuery.ajaxSetup( | |
beforeSend: (xhr) -> | |
xhr.setRequestHeader('X-Auth-Token', | |
App.Session.getAuthenticationToken()) | |
) | |
# ... | |
class App.Session | |
# ... | |
getAuthenticationToken: -> |
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
10 | _ -> 10 (+5) | |
| _________/ \ ----------------------- | |
5 | | -> 5 ____ 5 (-5) | Criteria color legend | | |
| / | e.g: | | |
0 |__________________________________ | [] (blue): Google PR | | |
2012-09-24 2012-10-17 2012-10-24 ----------------------- |
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
# ./spec/support/api/helper.rb | |
module ApiHelper | |
include Rack::Test::Methods | |
def app | |
Rails.application | |
end | |
end | |
RSpec.configure do |c| |
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
#!/usr/bin/env ruby | |
#^syntax detection | |
site 'http://community.opscode.com/api/v1' | |
cookbook 'build-essential' | |
cookbook 'ruby_build', :git => 'git://github.com/fnichol/chef-ruby_build.git' | |
cookbook 'rbenv', :git => 'git://github.com/fnichol/chef-rbenv' | |
cookbook 'apt', :git => 'git://github.com/opscode-cookbooks/apt' |
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
group :development, :test do | |
# ... | |
if RUBY_PLATFORM.downcase.include?("darwin") | |
gem 'rb-fsevent' | |
gem 'growl' | |
end | |
if RUBY_PLATFORM.downcase.include?("linux") | |
gem 'libnotify' |
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
=begin | |
Machine Learning study predicts the Backbone JavaScript framework as the most | |
successful emerging web technology, with reproduceable results. | |
Here's one of such reproductions. | |
=end | |
[29] pry(main)> !!defined?(Rails) #=> true | |
[30] pry(main)> User.count #=> 385 users | |
[31] pry(main)> User.where(:"profile.skills".in => ["forgery"]).size #=> 378 made-up users | |
[32] pry(main)> User.where(:"profile.skills".in => ["Ruby"]).size #=> 1 errrr, just me? |
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
module ApiAuthOverride | |
[:get, :post, :put, :delete, :patch].each do |method| | |
define_method(method) do |url, params=nil| | |
access_token = { access_token: current_token } | |
super(url, params ? params.merge(access_token) : access_token) | |
end | |
end | |
end | |
# ... |
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
$(document).on 'click', '.highlight-trigger' , (evt) -> | |
evt.preventDefault() | |
console.log "On highlight trigger" | |
highlightCurrentSelection() and deselectEverything() |
OlderNewer