Skip to content

Instantly share code, notes, and snippets.

Gabriel Cebrian gabceb

Block or report user

Report or block gabceb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am gabceb on github.
  • I am gabceb ( on keybase.
  • I have a public key ASC41clzTL3dQM9dHkLDX2xVJ-JrJXUBkMdp0HDDcDVWBQo

To claim this, I am signing this object:

gabceb /
Created Mar 18, 2014
hijack links for pushState in Backbone using Coffeescript. Original JS code at
# Use absolute URLs to navigate to anything not in your Router.
# Only need this for pushState enabled browsers
if Backbone.history && Backbone.history._hasPushState
# Use delegation to avoid initial DOM selection and allow all matching elements to bubble
$(document).delegate("a", "click", (evt) ->
# Get the anchor href and protcol
href = $(this).attr("href")
protocol = "#{this.protocol}//"
View get_me_that_message.rb
## This piece of code is not optimized for beauty or # of lines so don't judge :p
require 'open-uri'
require 'JSON'
url = ""
while true do
url = url.gsub("challenge", "challenge.json")
json = JSON.parse(open(url).read)
gabceb / chef-error
Created May 31, 2013
Error while sudo chef-client
View chef-error
Relevant File Content:
36: # Evaluates the LWRP resource file and instantiates a new Resource class.
37: def self.build_from_file(cookbook_name, filename, run_context)
38: rname = filename_to_qualified_string(cookbook_name, filename)
40: # Add log entry if we override an existing light-weight resource.
View gist:5399296
use_static_ip: true
image_type: c1.medium
image_type: m1.small
gabceb / gist:5113767
Created Mar 8, 2013
Handling 404, 401 and 500 exceptions on Rails
View gist:5113767
class ApplicationController < ActionController::Base
unless Rails.application.config.consider_all_requests_local
#rescue_from Exception, with: :render_500
rescue_from ActionController::RoutingError, with: :render_canvas_404
rescue_from ActionController::UnknownController, with: :render_404
rescue_from AbstractController::ActionNotFound, with: :render_404
rescue_from ActiveRecord::RecordNotFound, with: :render_404
rescue_from ActiveResource::ForbiddenAccess, with: :render_403
gabceb / ConvertXLS.ps1
Created May 3, 2011
Powershell script to convert all xls documents to xlsx in a folder recursively
View ConvertXLS.ps1
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbook
write-host $xlFixedFormat
$excel = New-Object -ComObject excel.application
$excel.visible = $true
$folderpath = "C:\Users\gabceb\Documents\testXLS"
$filetype ="*xls"
Get-ChildItem -Path $folderpath -Include $filetype -recurse |
ForEach-Object `
$path = ($_.fullname).substring(0, ($_.FullName).lastindexOf("."))
You can’t perform that action at this time.