Skip to content

Instantly share code, notes, and snippets.

@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
@thebigreason
thebigreason / social-sharing-alignment.html
Created October 18, 2011 17:48
Align Facebook Like, Twitter Tweet and Google +1 buttons
<div class="social">
<span class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="[your-url-here]">Tweet</a>
</span>
<span class="google">
<g:plusone size="medium" href="[your-url-here]"></g:plusone>
</span>
<span class="Facebook">
<iframe src="https://www.facebook.com/plugins/like.php?href=[your-url-here]&amp;show_faces=false&amp;layout=button_count" scrolling="no" frameborder="0" style="height: 21px; width: 100px" allowTransparency="true"></iframe>
</span>
@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
@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) {
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]