Skip to content

Instantly share code, notes, and snippets.

View gnepud's full-sized avatar

Peng Du gnepud

  • Grenoble, France
View GitHub Profile
@gnepud
gnepud / engine.rb
Created June 20, 2012 08:12
Testing routes with Rails 3.2 mountable engines and RSpec 2
# your-engine/lib/magic/rails/engine.rb
module Magic
module Rails
module Engine
##
# Automatically append all of the current engine's routes to the main
# application's route set. This needs to be done for ALL functional tests that
# use engine routes, since the mounted routes don't work during tests.
#
@gnepud
gnepud / active_model_serializers.rb
Created June 27, 2012 07:58 — forked from benedikt/active_model_serializers.rb
Makes mongoid and active_model_serializers play nicely together
# config/initializers/active_model_serializers.rb
Mongoid::Document.send(:include, ActiveModel::SerializerSupport)
Mongoid::Criteria.delegate(:active_model_serializer, :to => :to_a)
@gnepud
gnepud / app.js
Created July 2, 2012 08:00 — forked from atinux/app.js
Backbone JS infinite data with Node JS and Express JS
/*
** Client side - /public/src/app.js
*/
var myApp = {
// Collections
Collections: {
list: Backbone.Collection.extend()
},
// Views
@gnepud
gnepud / jquery.ba-tinypubsub.js
Created July 3, 2012 08:44 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@gnepud
gnepud / coffee.js
Created July 5, 2012 20:25 — forked from grignaak/coffee.js
A requireJS plugin to load CoffeeScript
(function() {
var origDefine = define;
function redefine(name, definitions) {
return function (prereqs, definition) {
if (arguments.length > 2) {
throw new Error('Cannot have more than two arguments to define in ' + name);
} else if (arguments.length === 1) {
definition = prereqs;
prereqs = [];
@gnepud
gnepud / model_caching.coffee
Created July 11, 2012 17:42 — forked from rstacruz/model_caching.coffee
Backbone.js model caching
# ## Backbone model caching
# This is a simple solution to the problem "how do I make less requests to
# my server?".
#
# Whenever you need a model instance, this will check first if the same thing
# has been fetched before, and gives you the same instance instead of fetching
# the same data from the server again.
#
# Reusing the same instance also has the great side-effect of making your
# model changeable from one part of your code, with your changes being available
@gnepud
gnepud / db.rb
Created September 10, 2012 12:21 — forked from alg/db.rb
namespace :db do
desc 'Seed database from db/seed.sql file instead of the traditional db/seed.rb'
namespace :seed do
config = Rails::Configuration.new.database_configuration[RAILS_ENV]
seed_sql = File.expand_path(File.dirname(__FILE__) + '/../../db/seed.sql')
if !File.exists?(seed_sql)
puts "Missing RAILS_ROOT/db/seed.sql"
@gnepud
gnepud / a start
Created September 20, 2013 08:36 — forked from dorkalev/a start
sentence = "there is a wild rose"
letters = sentence.gsub(' ','').split(//)
@gnepud
gnepud / nl.sh
Last active August 29, 2015 14:15 — forked from yyx990803/nl.sh
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
@gnepud
gnepud / ibkr-claude-prompts.md
Created June 28, 2026 13:37 — forked from ahvin2020/ibkr-claude-prompts.md
IBKR + Claude — 6 copy-paste prompts (portfolio X-ray, stock hunt, 1-yr outlook, daily brief, options manager, options spotter)

IBKR + Claude — Round 2: the 6 prompts (copy-paste)

1 — Portfolio X-ray dashboard (visual + actionable)

Connect to my IBKR account and build me an actionable portfolio X-ray as a
self-contained HTML dashboard I can open in my browser.

GOLDEN RULE — be GRAPHICAL-FIRST: show every piece of information as a visual
(chart, gauge, heatmap, treemap, colored badge, progress bar, or sparkline)