Skip to content

Instantly share code, notes, and snippets.

View lemanchester's full-sized avatar

Lennon Manchester lemanchester

View GitHub Profile
@lemanchester
lemanchester / benchmark-string-result
Created February 24, 2014 14:59
String Interpolation using Hash Vs. String Interpolation. Benchmark on ruby 1.9.3 to verify which one has a better performance.
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)
@lemanchester
lemanchester / wtf
Last active August 29, 2015 13:57
DateTime Ruby to Javascript - WTF?
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
@lemanchester
lemanchester / example
Created April 1, 2014 18:04
NVD3 - Cumulative Chart (getting wrong yScale)
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<style>
body {
overflow-y:scroll;
}
@lemanchester
lemanchester / install_ruby
Created April 27, 2015 00:33
Installing Ruby 2.1.5 on Ubuntu
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":
@lemanchester
lemanchester / ruby_convert_array_to_hash.md
Created October 15, 2015 20:21
Convert Ruby Array to Hash

Convert Array to Hash

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"}

Aeroporto

A taxis is around 65.000

or you can get a bus like 15 or 20

it takes you to to San Diego and then a cab or uber

Best Burguer