One pattern I've noticed lately is using rem
as a unit of distance in CSS. This seems like a pretty good idea.
.box {
height: 1.5rem;
padding: 1rem;
}
.select2-container { | |
box-sizing: border-box; | |
display: inline-block; | |
margin: 0; | |
position: relative; | |
vertical-align: middle | |
} | |
.select2 { | |
/*width: calc(100% - 45px) !important;*/ | |
width: 100% !important; |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
require 'benchmark' | |
def it_fibonacci(n) | |
fib_arr = [0,1] | |
(2..(n.to_i) - 1).each do |x| | |
fib_arr << fib_arr[x-1] + fib_arr[x-2] | |
end | |
return fib_arr | |
end |
When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.
filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&id=${fileid}"
Adaptive Streaming has become the neccessity for streaming video and audio. Unfortantely, as of this post, there isn't a whole lot of tutorials that accumulate all of the steps to get this working. Hopefully this post achieves that. This post focuses on using Amazon Web Services (AWS) to transcode for HLS and DASH and be the Content Delivery Network (CDN) that delivers the stream to your web page. We'll be using Video.js for the HTML5 player as well as javascript support libaries to make Video.js work with HLS and DASH.
After automatically updating Postgres to 9.6.1 via Homebrew, the pg_ctl start command didn't work. | |
The error was something like "database files are incompatible with server". | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.1 and latest 9.5.x installed, and keep 9.6.1 as default | |
brew unlink postgresql | |
brew install postgresql95 | |
brew unlink postgresql95 | |
brew link postgresql |
#!/usr/bin/env ruby | |
require 'RMagick' | |
require 'fileutils' | |
#color parser from https://gist.github.com/edouard/1787879 | |
TOP_N = 10 # Number of swatches | |
def sort_by_decreasing_frequency(img) | |
hist = img.color_histogram | |
sorted = hist.keys.sort_by {|p| -hist[p]} | |
new_img = Magick::Image.new(hist.size, 1) |
def delete_failed_job_if | |
redis = Resque.redis | |
(0...Resque::Failure.count).each do |i| | |
string = redis.lindex(:failed, i) | |
break if string.nil? | |
job = Resque.decode(string) | |
should_delete_job = yield job | |
next unless should_delete_job |