This helper has finally been moved into a gem called nav_lynx!
https://github.com/vigetlabs/nav_lynx
http://rubygems.org/gems/nav_lynx
Thanks to @brianjlandau and @reagent for getting that set up and tested!
## Hstore Method Missing Extension | |
module HstoreModel | |
def method_missing(method, *args, &block) | |
key = method.to_s.gsub('=','').to_sym | |
sym_options = options.symbolize_keys | |
if !self.class.attribute_methods_generated? | |
self.class.define_attribute_methods | |
if respond_to_without_attributes?(method) | |
send(method, *args, &block) |
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled. | |
Using the code from twitter bootstrap documentation page, this code is customized for table header. | |
Create the table with following layout - | |
<table class="table-fixed-header"> | |
<thead class="header"> | |
<tr> | |
<th>Column 1</th> | |
<th>Column 2</th> | |
<th>Column 3</th> |
################### | |
# http://stackoverflow.com/questions/639647/git-and-asp-mvc | |
################### | |
# | |
################### | |
# compiled source # | |
################### | |
*.com | |
*.class | |
*.dll |
This helper has finally been moved into a gem called nav_lynx!
https://github.com/vigetlabs/nav_lynx
http://rubygems.org/gems/nav_lynx
Thanks to @brianjlandau and @reagent for getting that set up and tested!
task :orphaned_check => :environment do | |
Dir[Rails.root.join('app/models/*.rb').to_s].each do |filename| | |
klass = File.basename(filename, '.rb').camelize.constantize | |
next unless klass.ancestors.include?(ActiveRecord::Base) | |
orphanes = Hash.new | |
klass.reflect_on_all_associations(:belongs_to).each do |belongs_to| | |
assoc_name, field_name = belongs_to.name.to_s, belongs_to.foreign_key.to_s |
#!/bin/bash | |
OUT="changesets.json" | |
echo "[" > $OUT | |
hg log | grep "^changeset:" | sed 's/changeset.*:/ "/g' | sed 's/$/",/g' | sed '$s/,$//' >> $OUT | |
echo ']' >> $OUT |
# | |
# Slightly tighter CORS config for nginx | |
# | |
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
# | |
# Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
# don't seem to play nicely with this. | |
# |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
angular.module('jobFoundryDirectives').directive 'spy', ($location) -> | |
restrict: "A" | |
require: "^scrollSpy" | |
link: (scope, elem, attrs, scrollSpy) -> | |
attrs.spyClass ?= "current" | |
elem.click -> | |
scope.$apply -> | |
$location.hash(attrs.spy) |
app.directive('scrollSpy', function ($window) { | |
return { | |
restrict: 'A', | |
controller: function ($scope) { | |
$scope.spies = []; | |
this.addSpy = function (spyObj) { | |
$scope.spies.push(spyObj); | |
}; | |
}, | |
link: function (scope, elem, attrs) { |