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
| references: | |
| defaults: &defaults | |
| working_directory: ~/app | |
| docker: | |
| - image: circleci/node:8.1.4-browsers | |
| npm_permissions: &npm_permissions | |
| run: | |
| name: set-user-permissions |
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
| unless ARGV[0] && ARGV[1] | |
| puts "Usage: set_password.rb username password" | |
| exit 1 | |
| end | |
| require 'chef' | |
| require 'chef/config' | |
| require 'chef/webui_user' | |
| Chef::Config.from_file(File.expand_path("~/.chef/knife.rb")) |
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
| http = require 'http' | |
| server = http.createServer (req, res) -> | |
| res.writeHead 200, {'Content-Type': 'text/plain'} | |
| res.end 'Hello World\n' | |
| server.listen 8124, "127.0.0.1", () -> | |
| console.log 'Server running at http://127.0.0.1:8124/' |
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
| BEGIN { | |
| require 'net/http' | |
| Net::HTTP.module_eval do | |
| alias_method '__initialize__', 'initialize' | |
| def initialize(*args,&block) | |
| __initialize__(*args, &block) |
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
| # unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| # 16 workers and 1 master | |
| worker_processes (rails_env == 'production' ? 16 : 4) | |
| # Load rails+github.git into the master before forking workers | |
| # for super-fast worker spawn times | |
| preload_app 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
| class Proc | |
| def <<(other) | |
| case other | |
| when Proc | |
| Proc.new do |*args| | |
| call(other.call(*args)) | |
| end | |
| else | |
| call(other) | |
| 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
| def restrict_to_owner(application, error = false, &block) | |
| return unless logged_in? | |
| if application.is_owner? current_user | |
| p &block | |
| p &block.call | |
| &block.call | |
| elsif error | |
| flash[:error] = 'You must be an owner of this application to do that.' | |
| redirect_to(application) |
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
| # ===================== | |
| # Spell: Argument Array | |
| # ===================== | |
| # Collapse a list of arguments into an array. | |
| def my_method(*args) | |
| args.map {|arg| arg.reverse } | |
| 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
| # =================== | |
| # Spell: Around Alias | |
| # =================== | |
| # Call the previous, aliased version of a method from a redefined method. | |
| class String | |
| alias :old_reverse :reverse | |
| def reverse |
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
| # =================== | |
| # Spell: Blank Slate | |
| # =================== | |
| # Remove methods from an object to turn them into Ghost Methods (http://gist.github.com/534776). | |
| class C | |
| def method_missing(name, *args) | |
| "a Ghost Method" | |
| end |
NewerOlder