This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mailChecker = { | |
address: '[email protected]', | |
constructor: function() { | |
this.checkMail(); | |
// method 1: use closure | |
var context = this; | |
function check() { context.checkMail(); } | |
// end of method 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create(x) { | |
// {node, name, child, attribute, property, event, link (node, ), service, append} | |
if (x instanceof Widget) | |
x = x.main(); | |
if (x.nodeType) | |
return x; | |
var node = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var node = this.create({ | |
name: 'edit' + | |
' ' + issue.mark + | |
' ' + issue.folder, | |
property: {issue: issue.id}, | |
reference: {edit: issue.node}, | |
child: [ | |
{name: 'content', child: [ | |
{name: 'title', child: [ | |
{name: 'left mark'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; | |
Date.prototype.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; | |
Date.prototype.military = !/\b(am|pm)\b/i.test(new Date().toLocaleTimeString()); | |
Date.prototype.military = false; | |
(function () { | |
var date = new Date(); | |
date.setFullYear(2013, 10, 11); | |
var string = date.toLocaleDateString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:{var width = 800; var height = 600; var dy = window.outerHeight - document.documentElement.clientHeight; var dx = window.outerWidth - document.documentElement.clientWidth; window.resizeTo(width + dx, height + dy);} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resolveURL(baseURL, relativeURL) { | |
var html = document.implementation.createHTMLDocument(""); | |
var base = html.createElement("base"); | |
base.setAttribute("href", baseURL); | |
var a = html.createElement("a"); | |
a.setAttribute("href", relativeURL); | |
html.head.appendChild(base); | |
html.body.appendChild(a); | |
return a.href; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#" onclick="return onLinkClick(this)" link="http://softline.ru">SoftLine</a> | |
window.addEventListener('onload', onLoad, false); | |
function onLoad() { | |
var nodes = document.getElementsByTagName('a'); | |
for (var i = nodes.length; i--;) { | |
var node = nodes[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <stdio.h> | |
#include <math.h> | |
#include <time.h> | |
typedef unsigned long characters_count_t; | |
typedef char character_t; | |
typedef unsigned char unsigned_character_t; | |
void mostFrequentCharacterEx(character_t *str, characters_count_t size, character_t *character, characters_count_t *count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum EditOperation<Element> { | |
case Delete(index: Int) | |
case Insert(index: Int, element: Element) | |
case Substitute(index: Int, element: Element) | |
case DoNothing | |
var distance: Int { | |
switch self { | |
case .DoNothing: |