Skip to content

Instantly share code, notes, and snippets.

@ctweney
ctweney / calendar.rb
Created October 30, 2014 20:07
Batch API calls don't observe auto_refresh_token setting
require 'rubygems'
require 'google/api_client'
require 'google/api_client/client_secrets'
require 'google/api_client/auth/file_storage'
require 'sinatra'
require 'logger'
enable :sessions
CREDENTIAL_STORE_FILE = "#{$0}-oauth2.json"
@julianduque
julianduque / jquery.extend.js
Last active September 26, 2015 08:08
jQuery useful and custom extensions
/**
* jQuery useful and custom extensions
*/
/**
* Non ajax plugin as seen in: http://stackoverflow.com/questions/1149454/non-ajax-get-post-using-jquery-plugin
*/
(function(jQuery) {
$.extend({
doGet: function(url, params) {
@royratcliffe
royratcliffe / pg.rake
Created October 2, 2011 14:26
Rake task to dump PostgreSQL structure using a compatible pg_dump
namespace :pg do
namespace :structure do
# Does exactly the same as db:structure:dump but with one important
# difference. It tries to use a compatible version of pg_dump. If you see
# the following error message, use pg:structure:dump instead.
#
# pg_dump: server version: 9.1.0; pg_dump version: 9.0.4
# pg_dump: aborting because of server version mismatch
# rake aborted!
# Error dumping database
@kianoshp
kianoshp / _arrow-box-mixin.scss
Last active December 25, 2015 00:09
A Sass mixin to create arrow boxes (similar to tooltips) borrowing from http://cssarrowplease.com, I created the following:
//Setting the initial border color to be red
$red: #9d261d;
//this mixin will set the box-shadow values. It will also allow for the felxibility of
//doing an inset shadow.
@mixin box-shadow ($isInset: false, $hOffset: 0, $vOffset: 0, $blur: 0, $spread: 0, $color: #ccc) {
@if $isInset {
-moz-box-shadow: inset $hOffset $vOffset $blur $spread $color;
-webkit-box-shadow: inset $hOffset $vOffset $blur $spread $color;
box-shadow: inset $hOffset $vOffset $blur $spread $color;
@biovisualize
biovisualize / README.md
Last active March 4, 2016 22:43
D3 chart plugin template

A template example to write simple chart plugins on top of D3. It is a base for discussion, so your are much welcome to modify it and comment it. The requirements are discussed on the wiki.

This implementation provides: div or svg parent, variants (bars or stacked bars), position, relative position (after or under another chart of the same svg parent), margins, gap between bars (in %), transition duration, separated data and labels (to discuss), uses axis component (to complete), chart size taken from the parent and will resize with it, all items accessible from CSS for styling, most options optional, automatic redraw on setting change and zero argument returns the value.

In this example, the first bar chart data updates periodically and a mouse click changes chart type.

@shreyas-satish
shreyas-satish / gist:1363413
Created November 14, 2011 06:59
Rails 3 routing : Map namespace to subdomain
constraints :subdomain => "admin" do
scope :module => "admin", :as => "admin" do
resources :players
end
end
@metaskills
metaskills / gist:3170386
Created July 24, 2012 14:47
Mapping A Sass List To A Comma Separated Selector
// Using this code below, I was able to itterate over a list of
// color names and append them to an empty list. I was then able
// to use the selectors from there.
$selectors: ();
@each $value in $my-colors-names {
$selector: unquote(".box.#{$value} .box-header");
$selectors: append($selectors, $selector, comma);
}
#{$selectors} { @extend .color-white; }
@mrdanadams
mrdanadams / create_origin.sh
Created November 22, 2011 20:48
Private github repos
$ cd git
$ mkdir yourproject.git
$ cd yourproject.git
$ git --bare init
@emilsoman
emilsoman / custom_auth_failure_app.rb
Last active March 3, 2021 12:49
Custom failure app to render a custom json on auth failure
class CustomAuthFailure < Devise::FailureApp
def respond
self.status = 401
self.content_type = 'json'
self.response_body = {"errors" => ["Invalid login credentials"]}.to_json
end
end
@twalker
twalker / sublimetext_useful_shortcuts_pc.md
Last active July 10, 2021 11:34
A fork of useful sublime text keyboard shortcuts. Using markdown and making more readable from github.

Sublime Text - Useful Shortcuts (linux)

Sublime Text 3 documentation
= Right Mouse Button
= Left Mouse Button
= Shift
= Delete
= Enter
←↑→↓ = Arrow keys

Editing