fruits = [[6, "apple"], [7, "orange"], [8, "grape"], [24, "banana"], [30, "strawberry"], [66, "lemon"]]
Hash[*fruits.flatten(1)] # => {6=>"apple", 7=>"orange", 8=>"grape", 24=>"banana", 30=>"strawberry", 66=>"lemon"}
user system total real | |
hash interpolation 0.300000 0.010000 0.310000 ( 0.301211) | |
string interpolation 0.090000 0.000000 0.090000 ( 0.098942) | |
user system total real | |
hash interpolation 0.290000 0.010000 0.300000 ( 0.301891) | |
string interpolation 0.140000 0.000000 0.140000 ( 0.135461) | |
user system total real | |
hash interpolation 0.310000 0.010000 0.320000 ( 0.318774) |
Ruby: | |
DateTime.parse("2013-08-01 00:00:00").utc.to_i*1000 | |
1375315200000 | |
Javascript: | |
alert(d3.time.format('%m/%d/%Y')(new Date(1375315200000))) | |
Result |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css"> | |
<style> | |
body { | |
overflow-y:scroll; | |
} |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | |
tar -xvzf ruby-2.1.5.tar.gz | |
cd ruby-2.1.5/ | |
./configure --prefix=/usr/local | |
make | |
make install |
#!/usr/bin/env bash | |
# | |
# Install: | |
# curl -L https://gist.githubusercontent.com/lemanchester/260341aedc56cec082fb/raw/d74c358f5d6bbb7f3202a9ead5b450e93c8d8011/install_imagemagick.sh | bash | |
# | |
echo "*****************************************" | |
echo " Installing ImageMagick on Amazon Linux AMI " | |
echo "*****************************************" | |
echo "*" | |
echo "*" |
echo "*****************************************" | |
echo " Installing PhantomJs on Amazon Linux AMI " | |
echo "*****************************************" | |
echo "*" | |
echo "*" | |
echo "*" | |
echo "*****************************************" | |
echo " 1. Installing dependencies " | |
echo "*****************************************" | |
sudo yum -y install git lex bison gperf openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel libpng-devel libjpeg-devel |
require 'rails_helper' | |
describe ProductUploader do | |
include CarrierWave::Test::Matchers | |
let(:company) { seed :master_company } | |
let(:uploader) { ProductUploader.new(company, :image) } | |
it 'creates image versions' do | |
uploader.store!(File.open("#{Rails.root}/spec/support/images/death_star.jpg")) |
{ | |
"auto_complete_commit_on_tab": true, | |
"bold_folder_labels": true, | |
"drag_text": false, | |
"draw_white_space": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 15.0, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, | |
"ignored_packages": |