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(assignment3). | |
-export([fib/1, pieces/1]). | |
fib(0) -> | |
0; | |
fib(1) -> | |
1; | |
fib(N) when N > 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
-module(assignment2). | |
-export([maxThree/3, howManyEqual/3]). | |
maxThree(X,Y,Z) -> | |
case lists:sort([X,Y,Z]) of | |
[_,_,M] -> M; | |
_ -> 0 | |
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(first). | |
-export([double/1,mult/2,area/3,square/1,trebel/1]). | |
mult(X,Y) -> | |
X*Y. | |
double(X) -> | |
mult(2,X). | |
area(A,B,C) -> |
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(first). | |
-export([double/1,mult/2,area/3,square/1,trebel/1]). | |
mult(X,Y) -> | |
X*Y. | |
double(X) -> | |
mult(2,X). | |
area(A,B,C) -> |
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 CuriousNumbers | |
attr_reader :digit, :largest_num | |
BASE_CURIOUS_NUMS = [0, 1, 5, 6].freeze | |
def initialize(digit) | |
@digit = digit.abs | |
@largest_num = ('9'*@digit).to_i | |
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
# a tail call optimized ruby script to find happy number | |
def happy_number?(num, seen_number = {}) | |
# store num in hash for quick lookup | |
seen_number[num] = num | |
total = num | |
.to_s | |
.chars | |
.reduce(0) { |acc, digit| acc + digit.to_i ** 2 } |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>HEAD</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Authorization</AllowedHeader> | |
</CORSRule> | |
</CORSConfiguration> |
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
$.each($('.ghx-wrap-issue'), function(index, element) { | |
element.style.overflow = "auto" | |
element.style.height = "calc(100vh - 186px)" | |
}) |
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 puma { | |
server unix://home/deploy/apps/pte_backend/shared/tmp/sockets/pte_backend-puma.sock fail_timeout=0; | |
} | |
server { | |
server_name api.houseofenglish.online; | |
root /home/deploy/apps/pte_backend/current/public; | |
try_files $uri/index.html $uri @puma; |
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 'resque/tasks' | |
require 'resque/scheduler/tasks' | |
task "resque:setup" => :environment do | |
Resque.before_fork = Proc.new do |job| | |
ActiveRecord::Base.connection.disconnect! | |
end | |
Resque.after_fork = Proc.new do |job| | |
ActiveRecord::Base.establish_connection | |
end |