$('*').each(function () { | |
var colors = ['aqua', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'yellow']; | |
$(this).css('background-color', colors[Math.floor(Math.random()*colors.length)]); | |
$(this).css('font-family', 'Comic Sans MS'); | |
}); | |
$('img').each(function () { | |
var imgs = [ | |
'http://www.animatedgif.net/devilish/coolskul.gif', | |
'http://www.animatedgif.net/devilish/devildance_e0.gif', |
var fs = require('fs'); | |
var vips = require('../index'); | |
var imagemagick = require("imagemagick"); | |
var gm = require("gm"); | |
var epeg = require("epeg"); | |
var async = require("async"); | |
var assert = require("assert"); | |
var Benchmark = require("benchmark"); | |
var cv = require("opencv"); |
http://kolodny.github.io/bookmarklet.html | |
document.body.addEventListener('click', go); | |
alert('click on a form element to get a bookmarklet of the saved form'); | |
function go(event) { | |
var form = event.target; | |
while (form && form.tagName !== 'FORM') { | |
form = form.parentNode; | |
} |
/** | |
* A Javascript test runner in 20 lines of code | |
* From http://joakimbeng.eu01.aws.af.cm/a-javascript-test-runner-in-20-lines/ | |
*/ | |
(function () { | |
// The test queue: | |
var tests = []; | |
// Function to add tests: | |
this.test = function test (name, cb) { |
var request = require('request') | |
/** | |
* Handle multiple requests at once | |
* @param urls [array] | |
* @param callback [function] | |
* @requires request module for node ( https://github.com/mikeal/request ) | |
*/ | |
var __request = function (urls, callback) { |
/** | |
* Dependencies | |
*/ | |
var fs = require('fs'), | |
request = require('request'), | |
cp = require('child_process'), | |
spawn = cp.spawn; | |
var image = request("http://medpreps.com/wp-content/uploads/2012/05/cma-practice-test.jpg"); | |
var wm = request("https://github.com/linse/Gibberbot/diff_blob/f096f6d94b3fb745975ea5f61f5a43b47098598b/res/drawable/droid_watermark.png?raw=true"); |
// dependencies | |
var async = require('async'); | |
var path = require('path'); | |
var AWS = require('aws-sdk'); | |
var gm = require('gm').subClass({ | |
imageMagick: true | |
}); | |
var util = require('util'); | |
// get reference to S3 client | |
var s3 = new AWS.S3(); |
The final result: require() any module on npm in your browser console with browserify
This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.
Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5
The following will guide you through the process of installing Node.js on an AWS EC2 instance running Amazon Linux AMI 2016.09 - Release Notes
For this process I'll be using a t2.micro EC2 instance running Amazon Linux AMI (ami-d41d58a7). Once the EC2 instance is up-and-running, connect to your server via ssh
- Make sure our server has the latest packages :
sudo yum update -y