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
// Script to randomly select participants in FMFs design contest | |
// | |
// Requirements: | |
// - Nodejs 4.0+ | |
// | |
// Instructions: | |
// 1) Download script to directory | |
// 2) In directory, run `node formosa-vote.js` | |
// 3) Output is the Telegram display name and telegram url. |
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
Images |
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
# Coin Change Problem: | |
# Given a set of coin denominations, find the minimum number of coins to make change for a target amount. | |
# | |
# Analysis: | |
# 1. Optimal substructure (combination of optimal solutions to subproblems): | |
# Let S be the set of denominations and d(sub i) an individual denomination | |
# Let n be the target number. | |
# Let OS(n) be the optimal solution for n. | |
# | |
# If n > d(sub i) |
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
function! NumberToggle() | |
if(&relativenumber == 1) | |
set number | |
else | |
set relativenumber | |
endif | |
endfunc | |
nnoremap <C-n> :call NumberToggle()<cr> " Ctrl+n toggles relative line numbers on and off | |
:au FocusLost * :set number " Turns relative numbers off for all buffers not in focus |
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 Book | |
attr_accessor :title | |
def title | |
split_titles = @title.split | |
split_titles.each_with_index do |title, index| | |
case | |
when title =~ /(\Aan\z)|(\Aa\z)|(\Aand\z)|(\Ain\z)/ then next | |
when title =~ /(^the)/ && index != 0 then next | |
else title.capitalize! |
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 InWords | |
def in_words | |
single = { 1 => "one", 2 => "two", 3 => "three", 4 => "four", | |
5 => "five", 6 => "six", 7 => "seven", 8 => "eight", | |
9 => "nine" } | |
teens = { 10 => "ten", 1 => "eleven", 2 => "twelve", 3 => "thirteen", | |
4 => "fourteen", 5 => "fifteen", 6 => "sixteen", 7 => "seventeen", | |
8 => "eighteen", 9 => "ninteen" } |