Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
j-mcnally / SkinFix.js
Created February 28, 2012 01:31
Fixes verot's jquery select skin when using a ASP.NET dropdownlist that has Ajax Toolkit's Cascading Drop Downs
Sys.Application.add_load(function () {
var bound = [];
_.each(_.keys(Sys.Application._components), function (i) {
var q = Sys.Application._components[i];
if (q._name == "CascadingDropDownBehavior") {
if (bound.indexOf(q._id < 0)) {
q.add_populated(function (a, b, c) {
$(a._element).parent().siblings('.cmf-skinned-text').text('');
$(a._element).siblings('.cmf-skinned-text').text(a._element.options[a._element.selectedIndex].text);
@j-mcnally
j-mcnally / gist:2048362
Created March 16, 2012 03:30
Remote inline forms rails 3
jQuery("input[type='submit']").live("click", function(e) {
e.preventDefault();
var targetForm = jQuery(this).closest("form");
if (jQuery(targetForm).attr("data-remote") == "true") {
jQuery.rails.handleRemote(jQuery(targetForm));
}
else {
jQuery(targetForm).submit();
}
});
@j-mcnally
j-mcnally / Watchfile.coffee
Created September 7, 2012 22:30 — forked from lancejpollard/Watchfile.coffee
Tower + Ember Views
coffeecup = require('coffeecup')
watch /app\/views.*\.coffee$/
update: (path, callback) ->
try
nodes = path.replace("app/views/", "").split("/")
name = {}
data = File.read(path)
id = nodes.join("/")
@j-mcnally
j-mcnally / grunt.coffee
Created September 17, 2012 17:33
How to start a tower server?
# https://github.com/cowboy/grunt/blob/master/docs/task_init.md
# https://github.com/kmiyashiro/grunt-mocha
module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-less')
#grunt.loadNpmTasks('grunt-stylus')
grunt.loadNpmTasks('grunt-compass')
async = require('async')
mint = require('mint')
coffeecup = require('coffeecup')
fs = require('fs')
@j-mcnally
j-mcnally / gist:3740178
Created September 17, 2012 22:31
Fix hook.io and weak

git clone https://github.com/viatropos/tower.git

cd tower

make watch

Ctrl+c

npm install git://github.com/j-mcnally/hook.io

@j-mcnally
j-mcnally / grunt.coffee
Created September 17, 2012 22:58
grunt.coffee for tower
# https://github.com/cowboy/grunt/blob/master/docs/task_init.md
# https://github.com/kmiyashiro/grunt-mocha
# https://github.com/shama/grunt-hub/blob/master/tasks/watch.js
module.exports = (grunt) ->
require('./packages/tower-tasks/tasks')(grunt)
require('./coffee-inheritance')
_ = grunt.utils._
file = grunt.file
TypeError: Object <App.ApplicationController:ember359> has no method 'connectOutlet'
at [object Object].renderEmberView (http://localhost:3000/javascripts/vendor/javascripts/tower.js:11880:38)
at [object Object].<anonymous> (http://localhost:3000/javascripts/vendor/javascripts/tower.js:10095:23)
at [object Object]._renderTemplate (http://localhost:3000/javascripts/vendor/javascripts/tower.js:12511:30)
at [object Object].renderToBody (http://localhost:3000/javascripts/vendor/javascripts/tower.js:12466:21)
at [object Object].render (http://localhost:3000/javascripts/vendor/javascripts/tower.js:12462:21)
at [object Object].<anonymous> (http://localhost:3000/javascripts/app/client/controllers/homesController.js:28:19)
at [object Object].index (http://localhost:3000/javascripts/vendor/javascripts/ember.js:949:16)
at [object Object].<anonymous> (http://localhost:3000/javascripts/vendor/javascripts/tower.js:13495:23)
at [object Object].runCallbacks (http://localhost:3000/javascrip
Tower.Route.draw ->
#@resources 'blogs'
@match '/blog', to: 'blogs#index', action: 'index', state: 'blog.index', name: 'indexBlog', method: ['GET']
@match '/blog/posts/:id', to: 'blogs#show', action: 'show', state: 'blog.posts.show', name: 'postsBlog', method: ['GET']
@match '/culture', to: 'cultures#index', action: 'index', state: 'culture.index', name: 'indexCulture', method: ['GET']
@match '/contact', to: 'contacts#index', action: 'index', state: 'contact.index', name: 'indexContact', method: ['GET']
@match '/work', to: 'works#index', action: 'index', state: 'work.index', name: 'indexWork', method: ['GET']
@match '/team', to: 'teams#index', action: 'index', state: 'team.index', name: 'indexTeam', method: ['GET']
@root to: 'homes#index', action: "index"
#@match '/test', to: 'application#test'
file.expand(['app/stylesheets/client/**/*.scss']).forEach (name) ->
config.watch[name] =
files: [name]
tasks: [compass]
@match path, _.extend(action: "index", state: "#{many}.index", name: many, method: ['GET'], options)
@match "#{path}/new", _.extend(action: "new", state: "#{many}.new", name: "new#{camelOne}", options)
@match path, _.extend(action: "create", state: "#{many}.create", method: "POST", options)
@match "#{path}/:id", _.extend(action: "show", state: "#{many}.show", name: one, options)
@match "#{path}/:id/edit", _.extend(action: "edit", state: "#{many}.edit", name: "edit#{camelOne}", options)
@match "#{path}/:id", _.extend(action: "update", state: "#{many}.update", method: "PUT", options)
@match "#{path}/:id", _.extend(action: "destroy", state: "#{many}.destroy", method: "DELETE", options)