This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //The thing I don't like about this approach is you would need to include this or validation totally dies. | |
| //Maybe that's not so bad? Maybe you want to do it differently on each page? | |
| //Specific events | |
| (function() { bindValidation(["focusout", "keydown"]); }()); | |
| //Default events | |
| (function() { bindValidation([]); }()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function () { | |
| $('form.validated-form').each(function () { | |
| var mode = $(this).data('validationMode'); | |
| $(this).validate({ | |
| ajax: mode == 'ajax', | |
| continuationSuccess: function (continuation) { | |
| continuation.form.trigger('validation:success', continuation); | |
| }, | |
| bindingConfiguration: { | |
| //bindings is an array of selectors and corresponding events |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Source Error: | |
| Line 15: protected void Application_Start(object sender, EventArgs e) | |
| Line 16: { | |
| Line 17: FubuApplication.DefaultPolicies().StructureMapObjectFactory().Bootstrap(); | |
| Line 18: | |
| Line 19: } | |
| Source File: c:\Users\Jesse\Documents\Projects\FubuValidation\FubuValidation\Global.asax.cs Line: 17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //So, I came up with this when playing with an idea for a configuration DSL. It's like Expression Builders...I think. | |
| //I think it's really like Partial Application with named functions. | |
| //But is it rubbish? | |
| //This is a contrived example for addition | |
| var add = function(x){ | |
| //Right here is the basic pattern. | |
| //Rather than return a function, return and object with a named function so your chaining becomes more grammatical | |
| return{ | |
| to: function(y){ | |
| return x + y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Because I read twitter at work | |
| //Because we have a proxy that blocks t.co but not twitter.com | |
| //Because I have rewritten this from scratch more than once and not saved it | |
| //I'm keeping this here. | |
| //Paste into bookmarklet, run when I open twitter, be happy. | |
| javascript:(function(){$(document).on("hover","a.twitter-timeline-link",null,function(){var $this = $(this), xUrl = $this.attr("data-expanded-url"); $this.attr("href", xUrl);});})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fizzBuzz :: [Integer] -> [String] | |
| fizzBuzz list = [if mod el 15 == 0 then "FIZZBUZZ" else if mod el 3 == 0 then "FIZZ" else if mod el 5 == 0 then "BUZZ" else show el | el <- list] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var funkshun = (function(){ | |
| var concat = Array.prototype.concat; | |
| function replicate(n, x){ | |
| return n===0 ? [] : concat.call(replicate(--n, x),x); | |
| } | |
| function take(n, arr){ | |
| function _take(n, arr){ | |
| var head; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // hello world | |
| var curry = require('fn-curry'); | |
| var conditional = curry(function(pred, succ, fail){ | |
| return function(){ | |
| var args = Array.prototype.slice.call(arguments); | |
| return pred.call(this, args) ? succ.apply(this, args) : fail.apply(this, args); | |
| }; | |
| }); | |
| var even = function (i){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function IIFE(){ | |
| function init(){ | |
| var something = "cool", | |
| somethingElse = [1,2,3,4,5,6,7,8], | |
| $btn1 = $("btn1"), | |
| $btn2 = $("btn2"), | |
| $btn3 = $("btn3"); | |
| $btn1.click(function hander(evt){ | |
| console.log("1", something); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = dreamCars = [ | |
| { | |
| make: "Aston Martin", | |
| model: "DB9" | |
| }, | |
| { | |
| make: "Lotus", | |
| model: "Elise" | |
| }, | |
| { |