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 http = require('http'), | |
| util= require('util'); | |
| var req = http.get('http://www.reddit.com/r/golang.json', function(res) { | |
| var body = ""; | |
| if (!/^2[0-9]{2}$/.exec(res.statusCode)) { | |
| console.log(res.statusCode); | |
| } | |
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
| package main | |
| import ( | |
| "io" | |
| "log" | |
| "net/http" | |
| "os" | |
| ) | |
| func main() { |
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
| MyClass = { | |
| makeIOCall: function(url) { | |
| Y.io(url, { | |
| on: { | |
| success: this.successHandler | |
| } | |
| } | |
| } |
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
| YUI.add('testplugin', function(Y) { | |
| var MyPlugin = Y.Base.create('testplugin', Y.Plugin.Base, [], { | |
| initializer : function() { | |
| this.objectProperty = { | |
| def1: "foo", | |
| def2: "bar" | |
| } |
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
| initializer: function(cfg) { | |
| // service model promise | |
| cfg.service.then( | |
| Y.bind(this.serviceDataReceived, this), | |
| Y.bind(this.noServiceAvailable, this)); | |
| this.after('modelChange', function() { | |
| this.render(); | |
| }, this); | |
| }, |
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
| // Modules included onto the page here | |
| var yui; | |
| YUI().use('/*module names*/', function(Y) { | |
| yui = 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
| <!--[if !IE]><!--><script> // If It's not IE (or <IE10) | |
| if (/*@cc_on!@*/false) { // If cc_on exists then if (!false) | |
| document.documentElement.className+=' ie10'; // Add classname to element | |
| } | |
| </script><!--<![endif]--> | |
| // http://msdn.microsoft.com/en-us/library/8ka90k2e%28v=vs.94%29.aspx | |
| // Taken from http://www.impressivewebs.com/ie10-css-hacks/ |
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
| YUI({ | |
| modules: { | |
| 'mytext': { | |
| fullpath: 'mytext.txt' | |
| }, | |
| 'mymodule': { | |
| fullpath: 'mymodule.js', | |
| requires: 'mytext' | |
| } | |
| } |
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
| YUI({ | |
| modules: { | |
| 'module1': { | |
| path: 'path/to/module1.js', | |
| requires: ['modules', 'this', 'requires'] | |
| } | |
| } | |
| }).use('node', function(Y) { | |
| //module1 is not loaded |
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
| npm install lactate |