Skip to content

Instantly share code, notes, and snippets.

View gbalbuena's full-sized avatar
🏕️

Gabriel gbalbuena

🏕️
View GitHub Profile
@gbalbuena
gbalbuena / favicons.html
Last active December 20, 2015 15:49 — forked from whatnickcodes/favicons.html
HTML: many favicons declaration example, can i select as needed or put them all
<!DOCTYPE html>
<html>
<head>
<title>Untiled</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" href="http://scotch.io/images/icons/favicon-32.png" type="image/png"><!-- default favicon -->
<link rel="shortcut icon" href="http://scotch.io/favicon.ico"><!-- legacy default favicon (in root, 32x32) -->
@gbalbuena
gbalbuena / timezones
Created August 10, 2013 15:15 — forked from ykessler/timezones
Select input with timezones
<select name="timezone" >
<option disabled selected style='display:none;'>Time Zone...</option>
<optgroup label="US (Common)">
<option value="America/Puerto_Rico">Puerto Rico (Atlantic)</option>
<option value="America/New_York">New York (Eastern)</option>
<option value="America/Chicago">Chicago (Central)</option>
<option value="America/Denver">Denver (Mountain)</option>
<option value="America/Phoenix">Phoenix (MST)</option>
<option value="America/Los_Angeles">Los Angeles (Pacific)</option>
@gbalbuena
gbalbuena / _flash_messages.html.erb
Last active August 29, 2015 13:56 — forked from roberto/_flash_messages.html.erb
Code to show flash messages with the look and feel of bootstrap 3
<%# shared/_flash_messages.html.erb %>
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<i class='<%= bootstrap_icon_for(type) %>'></i> <%= message %>
</div>
<% end %>
@gbalbuena
gbalbuena / application.rb
Last active February 3, 2016 14:03 — forked from dustMason/application.rb
Rails Error field template bootstrap 3
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
html = %(<div class="error">#{html_tag})
html += %(<small>#{instance.error_message.to_a.to_sentence}</small>).html_safe unless html_tag =~ /^<label/
html += %(</div>)
html.html_safe
end
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp|
files = ftp.list
@gbalbuena
gbalbuena / where_is.rb
Created June 16, 2016 17:19 — forked from wtaysom/where_is.rb
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@gbalbuena
gbalbuena / capybara cheat sheet
Created October 3, 2016 16:23 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@gbalbuena
gbalbuena / latency.markdown
Created March 30, 2017 13:34 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@gbalbuena
gbalbuena / iterm2-solarized.md
Created July 30, 2017 00:48 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@gbalbuena
gbalbuena / .babelrc
Created February 13, 2018 10:34 — forked from thejmazz/.babelrc
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}