Skip to content

Instantly share code, notes, and snippets.

View trcarden's full-sized avatar

Timothy Cardenas trcarden

View GitHub Profile
@trcarden
trcarden / gist:2716346
Created May 17, 2012 04:25
Incorrect Backbone View Advice
// Instead of :
SearchView = Backbone.View.extend({
initialize: function(){
this.render();
},
render: function(){
// Compile the template using underscore
var template = _.template( $("#search_template").html(), {} );
// Load the compiled HTML into the Backbone "el"
@trcarden
trcarden / gist:2716372
Created May 17, 2012 04:30
Corrected Backbone View Advice
// Instead of
SearchView = Backbone.View.extend({
initialize: function(){
this.render();
},
render: function(){
// Compile the template using underscore
var template = _.template( $("#search_template").html(), {} );
// Load the compiled HTML into the Backbone "el"
@trcarden
trcarden / gist:2886824
Created June 7, 2012 06:05
Engine asset compilation on heroku
module Pandemic
class Engine < ::Rails::Engine
isolate_namespace Pandemic
initializer "pandemic.asset_addition", :group => :all do |app|
initializer_path = "#{Rails.root}/config/initializers/pandemic.rb"
# Forces rails to pull in the initializer even if initialize_on_precompile
# is false
@trcarden
trcarden / development.rb
Created July 30, 2012 06:01
Autoreload gems in development
# Inside config/environments/development.rb
# Do the following after every request to the server in development mode
ActionDispatch::Callbacks.to_cleanup do
# If the gem's top level module is currently loaded, unload it
if Object.const_defined?(:MyCoolGem)
Object.send(:remove_const, :MyCoolGem)
end
@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@trcarden
trcarden / gist:5587225
Created May 15, 2013 20:45
A Placeholder Gist for SurveyMonkey
{"web-app": {
"servlet": [
{
"servlet-name": "cofaxCDS",
"servlet-class": "org.cofax.cds.CDSServlet",
"init-param": {
"configGlossary:installationAt": "Philadelphia, PA",
"configGlossary:adminEmail": "[email protected]",
"configGlossary:poweredBy": "Cofax",
"configGlossary:poweredByIcon": "/images/cofax.gif",
@trcarden
trcarden / gist:5599953
Created May 17, 2013 15:46
get_response_counts
{
"data": {
"completed": 10,
"started": 1
},
"status": 0
}
@trcarden
trcarden / odoo-sh.py
Created November 2, 2016 17:28 — forked from dreispt/odoo-sh.py
Odoo Shell: run Odoo commands without a server RPC connection
"""
Setup:
Assuming Odoo 8.0 sources at ~/odoo:
$ cp odoo-sh.py ~/odoo
$ cd ~/odoo
$ python -i odoo-sh.py
Usage example:
>>> env = connect('my-db-name')
>>> Users = env['res.users']
@trcarden
trcarden / sortable_test.rb
Created June 25, 2019 06:26 — forked from twalpole/sortable_test.rb
Sortable demo test
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'selenium-webdriver'
gem 'webdrivers'
gem 'capybara'
gem 'byebug'
gem 'puma'
end