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
. |
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
sudo apt install apache2-utils | |
htpasswd -Bc registry.password registry | |
kubectl create namespace cert-manager | |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.1.1/cert-manager.yaml | |
kubectl apply -f kube-docker-registry.yaml | |
kubectl create secret docker-registry regcred \ |
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 'sinatra/base' | |
require 'rack/flash' | |
require 'warden' | |
require 'slim' | |
require 'sequel' | |
require 'sqlite3' | |
DB = Sequel.sqlite | |
DB.create_table :users do | |
primary_key :id |
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
import Cocoa | |
class ThreadsListItemRowView: NSTableRowView { | |
override func draw(_ dirtyRect: NSRect) { | |
super.draw(dirtyRect) | |
if isSelected == true { | |
NSColor(hexFromString: "#ff9800").set() | |
dirtyRect.fill() | |
} |
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 m(n) | |
seq = (0..n/2).to_a | |
res = [] | |
seq.each do |e| | |
r = (0..e).to_a | |
r << r.last while r.length < seq.length | |
res << r + r.reverse.drop(1) | |
end | |
res + res.reverse.drop(1) | |
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 fib_seq(n) | |
one, two, index, sequence = 0, 1, 0, [] | |
while index < n | |
one, two = two, (one + two) | |
sequence << two | |
index = index + 1 | |
end | |
sequence | |
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
gem 'jbuilder', '~> 2.5' | |
gem 'kaminari' |
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
# subscription/payment controller | |
def execute | |
payment = PayPal::SDK::REST::Payment.find(params[:paymentId]) | |
if payment.execute(payer_id: params[:PayerID]) | |
current_user.subscription.prolong_for(cookies.signed[:duration]) | |
clear_stash | |
redirect_to root_path, notice: "Subscribed successfully" | |
else | |
redirect_to root_path, error: "Something went wrong" |
NewerOlder