- https://rubygems.org hosts the Ruby gem for Ruby on Rails.
- The current stable version number of Rails is 5.1.4, with 5.2.0.beta2 being the overall latest version.
- As of this writing, Ruby on Rails has been downloaded 118,011,892 across all versions.
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
onDrop = (acceptedFiles, rejectedFiles) => { | |
const file = acceptedFiles.find(f => f) | |
const i = new Image() | |
i.onload = () => { | |
let reader = new FileReader() | |
reader.readAsDataURL(file) | |
reader.onload = () => { | |
console.log({ | |
src: file.preview, |
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
stats = Sidekiq::Stats.new | |
stats.queues | |
stats.enqueued | |
stats.processed | |
stats.failed |
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
#!/bin/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Get the dependencies (Ubuntu Server or headless users): | |
sudo apt-get update |
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
On Mac OSX | |
copy selected part: visually select text(type v or V in normal mode) and type :w !pbcopy | |
copy the whole file :%w !pbcopy | |
paste from the clipboard :r !pbpaste |
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 User < ActiveRecord::Base | |
# keep the default scope first (if any) | |
default_scope { where(active: true) } | |
# constants come up next | |
COLORS = %w(red green blue) |
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
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
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
git filter-branch --tree-filter 'rm -rf node_modules' --prune-empty HEAD | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
echo node_modules/ >> .gitignore | |
git add .gitignore | |
git commit -m 'Removing node_modules from git history' | |
git gc | |
git push origin master --force |
General purpose SSD have a maximum of 10.000 IOPS.
It is possible to detach non-root volume from running EC2 instance.
An EC2 placement group is used to determin how far are instances placed between each other. In cluster mode, they will be placed to reduce the latency inside a single AZ. In spread mode, they will be placed on different underlying hardware (and potentially in different AZ).
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
call "9263262904", {:callerID => 'sip:21588734@sip.tropo.net'} | |
ask "Who would you like to call? Just say Joe or John", { | |
:choices => "Joe, John", | |
:mode => "speech", | |
:recognizer => "en-PH", | |
:minConfidence => 0.6, | |
:onChoice => lambda { |event| say "You said" + event.value}, | |
:onBadChoice => lambda { |event| say "I'm sorry, I didn't understand what you said."}, | |
:onTimeout => lambda { |event| say "I'm sorry, I didn't hear anything"}, | |
:onHangup => lambda { |event| log "Caller disconnected"} |
NewerOlder