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
#!/bin/sh | |
############################################################## | |
# | |
# Rock-Solid Node.js Platform on Ubuntu | |
# Auto-config by apptob.org | |
# Author: Ruslan Khissamov, email: rrkhissamov@gmail.com | |
# GitHub: https://github.com/rushis | |
# | |
############################################################## |
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 | |
# Using Auth Tokens in ActiveResource | |
# Borrowed from http://stackoverflow.com/questions/2918419/add-api-key-to-every-request-in-activeresource/6124110#6124110 | |
require 'active_resource' | |
require 'awesome_print' | |
class Resource < ActiveResource::Base | |
class << self |
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 ReadIngredients | |
class << self | |
include Enumerable | |
def each | |
while input = gets.chomp | |
break if end_of_input?(input) | |
yield input | |
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
def delete_failed_job_if | |
redis = Resque.redis | |
(0...Resque::Failure.count).each do |i| | |
string = redis.lindex(:failed, i) | |
break if string.nil? | |
job = Resque.decode(string) | |
should_delete_job = yield job | |
next unless should_delete_job |
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 CommentCreated < Action | |
include WatchersToBeNotified | |
watchers_to_be_notified { | |
ticket_attr_reader :ticket | |
categories { | |
agents to_be_notified_if: :all_comments | |
user_assignees to_be_notified_if: :comment_assignment | |
group_assignees to_be_notified_if: :comment_group_assignment |
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
describe RepoSynchronizationJob do | |
it 'sets refreshing_repos to true before synchronization' do | |
is_refreshing_repos_set_to_true = Proc.new do |user_id| | |
User.find(user_id).refreshing_repos == true | |
end | |
user = create(:user, refreshing_repos: false) | |
github_token = 'token' | |
expect(user.refreshing_repos).to be_false | |
flexmock(RepoSynchronization).should_receive(:call).with(FlexMock.on(&is_refreshing_repos_set_to_true), Flexmock.any).once |
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
require 'mock_redis' | |
class Feature | |
class << self | |
attr_accessor :redis | |
end | |
def initialize(name) | |
@name = name | |
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
# ... | |
namespace :deploy do | |
desc 'Restart application' | |
task :restart => ["eye:reload", "eye:restart"] | |
after :published, :restart | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
require 'ansi' | |
def puts_red(text) | |
puts ANSI.red { text } | |
end | |
def puts_green(text) | |
puts ANSI.green { text } | |
end |
OlderNewer