Skip to content

Instantly share code, notes, and snippets.

View gbalbuena's full-sized avatar
🏕️

Gabriel gbalbuena

🏕️
View GitHub Profile
@gbalbuena
gbalbuena / portscan.rb
Created August 5, 2013 14:39
very simple port scanner in ruby
require 'socket' #socket library
def open_port(host, port)
sock = Socket.new(:INET, :STREAM)
raw = Socket.sockaddr_in(port, host)
puts "#{port} open." if sock.connect(raw)
rescue (Errno::ECONNREFUSED)
rescue(Errno::ETIMEDOUT)
end
@gbalbuena
gbalbuena / shadows.css
Last active December 20, 2015 15:49
css shadows
.box {
background: #FFF;
padding: 20px;
margin: 10px;
}
.box h1 {
text-align:center;
position:relative;
}
@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 / ribbon.css
Created August 5, 2013 15:26
Ribbon in css
.ribbon {
text-align: center;
position: relative;
color: #fff;
margin: 0 -30px 30px -30px;
padding: 10px 0;
text-shadow: 0 1px rgba(0,0,0,.8);
background: #00AA9C;
background-image: -moz-linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
background-image: -webkit-linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0));
@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 / ext3_color.js
Last active August 29, 2015 13:56
This code defines a new vtype for Extjs 3 for the definition of a color value type
Ext.apply(Ext.form.VTypes, {
// Color vtype definition
color: function(v) {return /^#(?:[0-9a-f]{3}){1,2}$/i.test(v);},
colorText: 'This field must be a valid hex web color.',
colorMask: /[#0-9a-f]/i,
});
@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
@gbalbuena
gbalbuena / Gemfile
Created March 1, 2014 00:40
Rails Firebird database setup
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
gem 'activerecord-fb-adapter'
gem 'activerecord-jdbc-adapter'
...
@gbalbuena
gbalbuena / SQL
Last active March 14, 2019 08:15
Change sql dialects in firebird database
Use CONNECT or CREATE DATABASE to specify a database
SQL> CONNECT C:\data\db\production.fdb;
Database: C:\data\db\production.fdb
SQL> show sql dialect;
Client SQL dialect is set to: 3 and database SQL dialect is: 3
SQL> set sql dialect 2
CON> show sql dialect;
WARNING: Client SQL dialect has been set to 2 when connecting to Database SQL dialect 3 database.
SQL> set sql dialect 1;
WARNING: Client SQL dialect has been set to 1 when connecting to Database SQL dialect 3 database.