Skip to content

Instantly share code, notes, and snippets.

View tobiastom's full-sized avatar

Tobias Tom tobiastom

View GitHub Profile
Array.prototype.unique = function() {
var uniqueKeys = {};
var items = this.length;
while( items ) {
uniqueKeys[this[--items]] = true;
}
var uniqueArray = [];
for( var key in uniqueKeys ) {
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 ( var key in keys )
if ( !keys.hasOwnProperty( key ) )
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Testing inline SVG …</title>
<style type="text/css" media="screen">
/* SVG-Namensraum unter dem Kürzel "svg" registriert */
@namespace svg "http://www.w3.org/2000/svg";
test – durchgefallen – danke.
@interface SquaceMenuItem : UIMenuItem {
SquaceMLAction *squaceAction;
}
@property (nonatomic, retain) SquaceMLAction *squaceAction;
@end;
<?php
class Foo {
protected $description_de = 'Beschreibung';
protected $description_en = 'Description';
protected $localizedProperties = array( 'description' );
public function __get( $key ) {
if ( !in_array( $key, $this->localizedProperties ) ) {
var foo = document.createElement('a')
foo.addEventListener('click', function() { console.log('yeah') }, false)
var event = document.createEvent('UIEvents')
event.initEvent('click', false, false)
foo.dispatchEvent(event)
// yeah
@tobiastom
tobiastom / gist:579108
Created September 14, 2010 14:16 — forked from jeena/gist:579071
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *thisDayComponents = [[NSDateComponents alloc] init];
[thisDayComponents setYear:2010];
[thisDayComponents setMonth:9];
[thisDayComponents setDay:1];
[thisDayComponents setCalendar:gregorian];
NSString *aDate = [[gregorian dateFromComponents:thisDayComponents] descriptionWithLocale:nil];
NSLog(@"day:%i date:%@", [thisDayComponents day], aDate);
<?php
$data = array(
'lulu',
array( 'foo' => 'bar' ),
);
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta charset="utf-8" />