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
View keybase.md

Keybase proof

I hereby claim:

  • I am gabceb on github.
  • I am gabceb (https://keybase.io/gabceb) on keybase.
  • I have a public key ASC41clzTL3dQM9dHkLDX2xVJ-JrJXUBkMdp0HDDcDVWBQo

To claim this, I am signing this object:

@gabceb
gabceb / backbone_pushstate_router.js.coffee
Created Mar 18, 2014
hijack links for pushState in Backbone using Coffeescript. Original JS code at https://gist.github.com/tbranyen/1142129
View backbone_pushstate_router.js.coffee
# 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 = "http://www.letsrevolutionizetesting.com/challenge"
while true do
url = url.gsub("challenge", "challenge.json")
json = JSON.parse(open(url).read)
@gabceb
gabceb / chef-error
Created May 31, 2013
Error while sudo chef-client
View chef-error
Relevant File Content:
----------------------
/var/lib/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lwrp_base.rb:
35:
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)
39:
40: # Add log entry if we override an existing light-weight resource.
View gist:5399296
roles:
app:
use_static_ip: true
cloud_providers:
aws:
image_type: c1.medium
memcached:
cloud_providers:
aws:
image_type: m1.small
@gabceb
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
end
@gabceb
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.