Skip to content

Instantly share code, notes, and snippets.

Array.prototype.unique = function() {
var uniqueKeys = {};
var items = this.length;
while ( items ) {
uniqueKeys[ this[ --items ] ] = true;
}
var uniqueArray = [];
for ( var key in uniqueKeys ) {
if ( uniqueKeys.hasOwnProperty( key ) ) {
Array.prototype.unique = function() {
var uniqueKeys = {};
var items = this.length;
while ( items ) {
uniqueKeys[ this[ --items ] ] = true;
}
var uniqueArray = [];
for ( var key in uniqueKeys ) {
if ( uniqueKeys.hasOwnProperty( key ) ) {
Array.prototype.unique = function () {
var keys = {},
result = [],
items = this.length
while (items)
keys[this[--items]] = true
for (item in keys)
if (keys.hasOwnProperty(item)) result.push(item)
// inject ist ein alternativer Name für reduce, auch bekannt als fold oder foldl
Array.prototype.forEach = function (callback) {
for (var index=0, length=this.length; index < length, index++)
callback(this[index])
}
Array.prototype.reduce = function (accumulator, callback) {
this.forEach(function (value)
accumulator = callback(accumulator, value)
<!DOCTYPE html>
<script type="text/javascript">
var http = (function () {
var PublicInterface = {}
function request (verb, uri, payload) {
var uri = uri || "/",
payload = payload || ""
<!DOCTYPE html>
<script type="text/javascript">
var http = (function () {
var PublicInterface = {}
function request (verb, uri, payload) {
var uri = uri || "/",
payload = payload || ""
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Testing inline SVG …</title>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Testing inline SVG …</title>
#!/usr/bin/env python
# encoding: utf-8
from collections import defaultdict
word2value = {'dog': 15, 'dogs': 20}
word2stem = {'dog': 'dog', 'dogs': 'dog'}
stem2value = defaultdict(int)
$(document.body).bind({
"DOMNodeInserted" : function (event) {
$(event.target).bind(
// „Hängt davon ab“
)
},
"DOMNodeRemoved" : function (event) {
$(event.target).unbind()
}
})