Note: this rough draft has turned into https://github.com/maxogden/art-of-node#art-of-node
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
var U = require("uglify-js"); | |
var fs = require("fs"); | |
var sys = require("sys"); | |
var code = fs.readFileSync("/tmp/test.js", "utf8"); | |
// 1. parse | |
var ast = U.parser.parse(code); | |
// 2. UglifyJS compress |
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
if(Meteor.isServer){ | |
Meteor.methods({ | |
myMeteorMethod: function() { | |
// load Future | |
Future = Npm.require('fibers/future'); | |
var myFuture = new Future(); | |
// call the function and store its result | |
SomeAsynchronousFunction("foo", function (error,results){ |
(function() { | |
var hidden = "hidden"; | |
// Standards: | |
if (hidden in document) | |
document.addEventListener("visibilitychange", onchange); | |
else if ((hidden = "mozHidden") in document) | |
document.addEventListener("mozvisibilitychange", onchange); | |
else if ((hidden = "webkitHidden") in document) | |
document.addEventListener("webkitvisibilitychange", onchange); |
if(Meteor.isClient){ | |
// set Session variable in method callback | |
Meteor.call('myMeteorMethod', "foo", function(error, result){ | |
Session.set('myMethodResult', result); | |
}); | |
// use reactive Session variable in helper | |
Template.myTemplate.helpers({ | |
myHelper: function(){ |
// requestAnimationFrame polyfill by @rma4ok | |
!function (window) { | |
var | |
equestAnimationFrame = 'equestAnimationFrame', | |
requestAnimationFrame = 'r' + equestAnimationFrame, | |
ancelAnimationFrame = 'ancelAnimationFrame', | |
cancelAnimationFrame = 'c' + ancelAnimationFrame, | |
expectedTime = 0, |
var cluster = require('cluster'); | |
var PORT = +process.env.PORT || 1337; | |
if (cluster.isMaster) { | |
// In real life, you'd probably use more than just 2 workers, | |
// and perhaps not put the master and worker in the same file. | |
cluster.fork(); | |
cluster.fork(); | |
cluster.on('disconnect', function(worker) { |
#!/usr/bin/env bash | |
set -u | |
set -e | |
export GIT_WORK_TREE="/var/www/example.com" | |
export NODE_VERSION="0.10" | |
echo "--> Checking out..." | |
git checkout -f |
As far as I am aware the time has come and as of Firefox 72 XUL has been stripped from firefox and so the method used to inject this scrollbar theme is no longer supported -- reference the following for future scroll themes:
Mozilla is currently working to phase out the APIs used to make this theme work. I will try to maintain each version until that time but eventually there will be no workaround. When that time comes there is a new, but more limited api for applying simple themes to scrollbars. In nightly I am currently using the following userContent.css
:root{
scrollbar-width: thin;
scrollbar-color: rgb(82, 82, 82) rgb(31, 31, 31);
}
#!/usr/bin/env ruby -w | |
# pnginator.rb: pack a .js file into a PNG image with an HTML payload; | |
# when saved with an .html extension and opened in a browser, the HTML extracts and executes | |
# the javascript. | |
# Usage: ruby pnginator.rb input.js output.png.html | |
# By Gasman <http://matt.west.co.tt/> | |
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos |