Skip to content

Instantly share code, notes, and snippets.

View gabrieljoelc's full-sized avatar

Gabriel Chaney gabrieljoelc

View GitHub Profile
@cblunt
cblunt / Gemfile
Created October 21, 2011 08:55
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@davidfowl
davidfowl / MyHub.cs
Created October 29, 2011 11:19
C# Hubs API
using System;
using System.Threading;
using System.Threading.Tasks;
using SignalR.Hubs;
namespace Server
{
public class MyHub : Hub
{
public void Foo()
@jasondentler
jasondentler / AuctionGrowl.js
Created February 26, 2012 01:05
NServiceBus-and-SignalR
/// <reference path="~/scripts/lib"/>
$(function() {
var auctionHub = $.connection.auctionHub;
auctionHub.onBidAccepted = function(itemId, itemName, amount) {
$.pnotify({
pnotify_title: "Out bid",
pnotify_text: "The new high bid for " + itemName + " is " + amount + ".",
pnotify_sticker: false
});
};
@jpoehls
jpoehls / gist:2030795
Created March 13, 2012 19:02
Using CTRL+W to close tabs in Visual Studio

In Tools | Options | Keyboard...

  1. Add CTRL+W as a Global shortcut for Window.CloseDocumentWindow
  2. Remove the CTRL+W shortcut for Edit.SelectCurrentWord

The caveat to this is if you are used to using CTRL+W to select the current word. If you do, find another shortcut that works for that.

@timruffles
timruffles / hash_converter.rb
Created May 24, 2012 09:47
rails hash formatter - hash/json to/from camel case and underscores
module HashConverter
class << self
def to_underscore hash
convert hash, :underscore
end
def to_camel_case hash
convert hash, :camelize, :lower
end
def convert obj, *method
case obj
@bentonporter
bentonporter / gist:2891463
Created June 7, 2012 20:51
Ruby - HMAC-SHA256 example
require 'openssl'
require 'Base64'
key = "secret-key"
data = "some data to be signed"
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), key, data)).strip()
@nuxlli
nuxlli / console.rb
Created July 10, 2012 17:43
To access url helpers (url_for, etc) from Rails console (Rails 3)
# Example from: http://snipplr.com/view/37063/
include Rails.application.routes.url_helpers
# set host in default_url_options:
default_url_options[:host] = "localhost"
# can then use:
url_for()
@shawnbot
shawnbot / xterm-256color.md
Last active March 22, 2024 16:26
Make OS X Terminal respect 256 colors in screen

1. Ensure that Terminal declares itself as "xterm-256color"

Under Terminal > Preferences... > (Profile) > Advanced, "Declare terminal as:" should be set to xterm-256color.

2. Build a version of screen that supports 256 colors

This is easy with homebrew:

brew install screen
@opsb
opsb / gist:3486581
Created August 27, 2012 08:00
Spinach adaptor for sauce/capybara
require 'capybara'
require 'sauce/job'
require 'sauce/capybara'
module Spinach
class Scenario
def fail!
@failed = true
end
def failed?
@johnpolacek
johnpolacek / gist:3827270
Last active January 20, 2023 15:46
Prevent FOUC
<!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ -->
<style type="text/css">
.no-fouc {display: none;}
</style>
<script type="text/javascript">
document.documentElement.className = 'no-fouc';
// add to document ready: $('.no-fouc').removeClass('no-fouc');
</script>