I no longer mantain this list. There are lots of other very comprehensive JavaScript link lists out there. Please see those, instead (Google "awesome JavaScript" for a start).
Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺
Locally, I'm at this commit:
$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date: Sun Apr 15 16:35:03 2012 +0200
When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.
// vanilla JS | |
var event = document.createEvent("UIEvents"); | |
event.initUIEvent("change", true, true); | |
document.querySelector('input[type=file]').dispatchEvent(event); | |
// jQuery | |
$('input[type=file]').trigger('change'); |
function exceptionalException(message) { | |
'use strict'; | |
if (exceptionalException.emailErrors !== false) { | |
exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?'); | |
} | |
} | |
//test | |
//exceptionalException('try 1!'); | |
//exceptionalException('try 2!'); |
<?php | |
function example_ajax_enqueue() { | |
// Enqueue javascript on the frontend. | |
wp_enqueue_script( | |
'example-ajax-script', | |
get_template_directory_uri() . '/js/simple-ajax-example.js', | |
array( 'jquery' ) | |
); |
for (var i = 0; i < 1024 * 1024; i++) { | |
process.nextTick(function () { Math.sqrt(i) } ) | |
} |
var flattenObject = function(ob) { | |
var toReturn = {}; | |
for (var i in ob) { | |
if (!ob.hasOwnProperty(i)) continue; | |
if ((typeof ob[i]) == 'object') { | |
var flatObject = flattenObject(ob[i]); | |
for (var x in flatObject) { | |
if (!flatObject.hasOwnProperty(x)) continue; |
I decided to share this snippet based on seeing what others were doing in this thread: https://www.reddit.com/r/homeassistant/comments/emvk9y/how_do_you_monitor_sensor_battery_levels_looking/
Basically dome device types of battery report the state in different locations and with different string
values that the change node or conditional logic just doesn't work nicely. Using the conditional logic on
this string state value might not be working fully how we think it is or at least didn't for me. When I was
debugging it and getting 10
outputted in a 100
bucket via the gt condition. The best way I've found to
handle these conditions is with a function node.
var AWS = require('aws-sdk'), | |
fs = require('fs'); | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk | |
AWS.config.loadFromPath('./aws-config.json'); | |
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos | |
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}}); | |
function uploadToS3(file, destFileName, callback) { |
server { | |
listen 80; | |
root /var/www/YOUR_DIRECTORY; | |
index index.php index.html index.htm; | |
################################################### | |
# Change "yoururl.com" to your host name | |
server_name yoururl.com; |