The spec has moved to a repo: https://github.com/defunctzombie/package-browser-field-spec to facilitate collaboration.
| app.filter('bytes', function() { | |
| return function(bytes, precision) { | |
| if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-'; | |
| if (typeof precision === 'undefined') precision = 1; | |
| var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], | |
| number = Math.floor(Math.log(bytes) / Math.log(1024)); | |
| return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; | |
| } | |
| }); |
| // Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
| // jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
| // author: Pawel Kozlowski | |
| var myApp = angular.module('myApp', []); | |
| //service style, probably the simplest one | |
| myApp.service('helloWorldFromService', function() { | |
| this.sayHello = function() { | |
| return "Hello, World!" |
| module.exports = function(grunt) { | |
| function noop() {} | |
| grunt.initConfig({ | |
| watch: { | |
| reload: { | |
| files: ['public/**', 'views/**'], | |
| tasks: 'reload' | |
| } | |
| }, |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
| var request = require('request'), | |
| zlib = require('zlib'); | |
| var headers = { | |
| "accept-charset" : "ISO-8859-1,utf-8;q=0.7,*;q=0.3", | |
| "accept-language" : "en-US,en;q=0.8", | |
| "accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", | |
| "user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2", | |
| "accept-encoding" : "gzip,deflate", | |
| }; |
| robocopy /b /e /xa:s /xjd /sl /a-:hs /mt /v /fp /eta /log:"D:\To\Directory\transfer.log" /tee "C:\From\Directory" "D:\To\Directory" | |
| (Note that the paths don't have a trailing backslash.) | |
| /b -- backup mode (there's a /zb option for restart mode, but it's a whole lot slower) | |
| /e -- copies subdirectories (including empty directories) in addition to files | |
| /xa:s -- exclude system files | |
| /xjd -- exclude junction points | |
| /sl -- copy symbolic links as links | |
| /a-:hs -- remove hidden/system attributes from files |
| var fs = require('fs'), | |
| url = require('url'); | |
| module.exports = function (rootDir, indexFile) { | |
| indexFile = indexFile || "index.html"; | |
| return function(req, res, next){ | |
| var path = url.parse(req.url).pathname; | |
| fs.readFile('./' + rootDir + path, function(err, buf){ |
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>
