Skip to content

Instantly share code, notes, and snippets.

View shtakai's full-sized avatar
🐤
I am leaning Ada.

Alyson shtakai

🐤
I am leaning Ada.
View GitHub Profile
@adamstegman
adamstegman / spec_helper.rb
Created April 19, 2011 05:28
Silence RSpec specs
RSpec.configure do |config|
config.before(:all, &:silence_output)
config.after(:all, &:enable_output)
end
# Redirects stderr and stdout to /dev/null.
def silence_output
@orig_stderr = $stderr
@orig_stdout = $stdout
@Kerrick
Kerrick / fizzbuzz.rb
Created April 24, 2012 20:36
Different solutions for Fizz Buzz in Ruby
def fizz_buzz_1(max)
arr = []
(1..max).each do |n|
if ((n % 3 == 0) && (n % 5 == 0))
arr << "FizzBuzz"
elsif (n % 3 == 0)
arr << "Fizz"
elsif (n % 5 == 0)
arr << "Buzz"
else
@learncfinaweek
learncfinaweek / gist:4121390
Created November 20, 2012 21:43
Security - Secure Password Storage

The ARTISTS table in the cfartgallery datasource used for examples is an excellent example of how NOT to store passwords. First, they are stored in clear text and the column is limited to only 8 characters.

ARTISTID
@mayuroks
mayuroks / vimrc
Last active May 30, 2016 04:02
vimrc
set t_Co=256
set pastetoggle=<F8>
colorscheme wombat256mod
set hlsearch
set tabstop=4
set softtabstop=4
set shiftwidth=4
let g:indent_guides_auto_colors=0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
@poad
poad / file0.txt
Last active September 13, 2015 06:11
【メモ】【まとめ】Ubuntu 14.04をインストールしたらやること ref: http://qiita.com/poad1010/items/c483be84df16ed1459a9
sudo aptitude update
sudo aptitude full-upgrade
@koyhoge
koyhoge / gist:afe31518f63c16120f2d
Last active June 1, 2023 06:32
エンジニアのための法律勉強会#1『受託開発における契約時の注意事項』参加メモ

エンジニアのための法律勉強会#1『受託開発における契約時の注意事項』参加メモ

前提

  • システム開発そのものは素人だけど、裁判にはクライアント/開発側の両方で関わったことがある。
  • 裁判官はもっとシステム開発については分かってない。
@abhinavmsra
abhinavmsra / money_best_practices.md
Last active November 12, 2023 13:00
Tips for Money Related Arithmetic in Ruby

Tips for Money Related Arithmetic in Ruby

  1. Never use float for performing arithmetic calculations relating to money.

    Floating numbers can sometimes show funky behaviour. It is not Ruby’s fault but the very implementation of floating numbers raises precision issues.

Examples of odd behaviour:

@voluntas
voluntas / realtime_movie_stream.rst
Last active August 5, 2024 09:58
リアルタイム動画配信コトハジメ
@mbajur
mbajur / .md
Created April 29, 2016 07:16
How to create small, unique tokens in Ruby

How to create small, unique tokens in Ruby

That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:

My choice: Dave Bass’s rand().to_s() trick

Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):

@necojackarc
necojackarc / active_job_retry_controlable.rb
Last active June 30, 2021 13:20
To enable ActiveJob to control retry
module ActiveJobRetryControlable
extend ActiveSupport::Concern
DEFAULT_RETRY_LIMIT = 5
attr_reader :attempt_number
module ClassMethods
def retry_limit(retry_limit)
@retry_limit = retry_limit