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 Coefficient | |
| def initialize(coefficient, power) | |
| @coefficient = coefficient | |
| @power = power | |
| end | |
| def format_coefficient | |
| case @coefficient.abs | |
| when 1 | |
| "" |
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
| require 'database_cleaner' | |
| RSpec.configure do |config| | |
| config.use_transactional_fixtures = false | |
| DatabaseCleaner.logger = Rails.logger | |
| config.before(:all) do | |
| DatabaseCleaner.clean_with(:truncation) | |
| 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
| export PROFILE_D="$HOME/.profile.d" | |
| if [ -d $PROFILE_D ]; then | |
| for conf in `ls $PROFILE_D`; do | |
| export ${conf}=`cat $PROFILE_D/${conf}` | |
| done | |
| fi |
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
| export PROFILE_D="$HOME/.profile.d" | |
| if [ -d $PROFILE_D ]; then | |
| for conf in `ls $PROFILE_D`; do | |
| export ${conf}=`cat $PROFILE_D/${conf}` | |
| done | |
| fi |
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 Project | |
| has_many :project_blocks | |
| has_many :upcoming_blocks, ->{ within(Date.current.beginning_of_week, 3.months.from_now.end_of_week) }, class_name: "ProjectBlock" | |
| 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
| mem, *processes = ARGV.map(&:to_i) | |
| rates = processes.map{|i| Rational(1, i)} | |
| def memory_for_second(second, processes) | |
| processes.reduce(0) {|sum, process| sum + (second / process)} | |
| end | |
| def minimum_second(mem, rates) | |
| (mem / rates.reduce(&:+) ).floor | |
| 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
| -module(dna). | |
| -export([count/2, nucleotide_counts/1]). | |
| nucleotides()-> ["A", "T", "C", "G"]. | |
| count(Strand, TargetNucleotide)-> | |
| case lists:member(TargetNucleotide, nucleotides()) of | |
| true -> | |
| erlang:length( | |
| lists:filter( |
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
| upstream rails_app { | |
| server 127.0.0.1:3000 fail_timeout=0; | |
| server 127.0.0.1:5000 fail_timeout=0; | |
| } | |
| server { | |
| listen 443 ssl default; | |
| server_name localhost; | |
| ssl_certificate /usr/local/etc/ssl/sslip.io.chained.crt.pem; | |
| ssl_certificate_key /usr/local/etc/ssl/sslip.io.key.pem; |
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
| <%= simple_form_for foo, url: url do |f| %> | |
| <% 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
| class Admin::BottlesController < Admin::ApplicationController | |
| # Full admin CRUD here | |
| end |