Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bmxpert1's full-sized avatar

Kevin Bouwkamp bmxpert1

View GitHub Profile
var inject_binding = function (allBindings, key, value) {
//https://github.com/knockout/knockout/pull/932#issuecomment-26547528
return {
has: function (bindingKey) {
return (bindingKey == key) || allBindings.has(bindingKey);
},
get: function (bindingKey) {
var binding = allBindings.get(bindingKey);
if (bindingKey == key) {
binding = binding ? [].concat(binding, value) : value;
We couldn’t find that file to show.
@bmxpert1
bmxpert1 / foreigner_ext.rb
Last active December 25, 2015 11:19
Foreigner methods to create and remove foreign keys for cross schema use in PostgreSQL
ActiveRecord::Migration.class_eval do
def add_foreign_key_ignore_prefix(from_table, to_table, options = {})
table_name_prefix = ActiveRecord::Base.table_name_prefix
ActiveRecord::Base.table_name_prefix = ''
add_foreign_key(from_table, to_table, options)
ActiveRecord::Base.table_name_prefix = table_name_prefix
end
def remove_foreign_key(from_table, options = {})
table_name_prefix = ActiveRecord::Base.table_name_prefix
@bmxpert1
bmxpert1 / admin_controller.rb
Created June 19, 2013 21:36
Rails browser based log file tail-er
class AdminController < ApplicationController
layout 'admin'
def logs
log = File.join(Rails.root, "log", "#{Rails.env}.log")
@lines = `tail -1024 #{log}`.split(/\n/)
end
end