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
@test | |
Feature: Viewing bulletins | |
In order to view the content on this website | |
As a visitor | |
I want to view bulletins | |
Background: | |
Given A Refinery user exists | |
Scenario: Listing all bulletins |
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 Article < ActiveRecord::Base | |
has_one :publication, :as => :publicationable | |
accepts_nested_attributes_for :publication | |
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
# https://github.com/blinks zsh theme | |
function _prompt_char() { | |
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then | |
echo "%{%F{blue}%}±%{%f%k%b%}" | |
else | |
echo ' ' | |
fi | |
} |
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
/** | |
* For a current project I need to wait to execute a code until some images have been loaded. | |
* Beside, I also need to execute a callback (in my specific code I want to show the image | |
* with a fade-in effect) every time a single image has been loaded. | |
* | |
* So basically I used two deferred objects: the nested one which is resolved for a single | |
* image successfull load event (or when image has been discarded) and the outside one, | |
* which is resolved when all deferred objects on single images have been resolved or rejected. | |
* | |
* This snippet also takes care all frequent issues when trying to load an image (excessive |
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 Retriable | |
# This will catch any exception and retry twice (three tries total): | |
# with_retries { ... } | |
# | |
# This will catch any exception and retry four times (five tries total): | |
# with_retries(:limit => 5) { ... } | |
# | |
# This will catch a specific exception and retry once (two tries total): | |
# with_retries(Some::Error, :limit => 2) { ... } | |
# |
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
# An abstract base class used to create simple serializers | |
# for ActiveRecord objects | |
class BaseSerializer | |
include Rails.application.routes.url_helpers | |
attr_reader :serialized_object | |
def initialize(serialized_object) | |
@serialized_object = serialized_object | |
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
desc 'Benchmark funds_raised methods' | |
ITERATIONS = 1000 | |
task benchmark_sql: :environment do | |
campaign = Campaign.last | |
Benchmark.bm do |bm| | |
bm.report('sql') do | |
ITERATIONS.times do |
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
▽ | |
#!upstart | |
description "node.js server" | |
author "vlad suciu" | |
start on startup | |
stop on shutdown | |
script | |
export HOME="/root" |
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
check process nginx with pidfile "/var/run/nginx.pid" | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
group www-data | |
if failed port 80 protocol HTTP | |
request /ok | |
with timeout 5 seconds | |
then restart | |
check process nodejs with pidfile "/var/run/fyves-renderer-8001.pid" |
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
upstream fyves_renderer { | |
server 127.0.0.1:8001; | |
server 127.0.0.1:8002; | |
server 127.0.0.1:8003; | |
} | |
server { | |
listen 80; | |
server_name localhost; |
OlderNewer