Skip to content

Instantly share code, notes, and snippets.

View leeoniya's full-sized avatar
😕
shaving bytes and milliseconds. dependencies: {}

Leon Sorokin leeoniya

😕
shaving bytes and milliseconds. dependencies: {}
View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@rkatic
rkatic / README.md
Created February 16, 2010 02:19
type() - a better typeof

type.js - offers an more consistent type checking of native values. It relays on the [[Class]] of objects instead on typeof results.

type2.js - variation that returns "object" for wrapped natives. This one is probably more noob-immune, avoiding some possible strange situations.

Consider something like this:

// Defined by third...

var foo = new String("foo");

@cowboy
cowboy / queue-explain.js
Created March 2, 2010 15:12
Serial asynchronous actions...
// Comments for http://bjam.in/jquery-queue
// Say you want to execute first_async_action() followed by
// second_async_action(), followed by third_async_action().
// You could do this:
first_async_action(function(){
second_async_action(function(){
third_async_action(function(){
alert( 'done!' );
@tobitailor
tobitailor / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
/*
Render SVG Arc with canvas commands
Usage: solveArc(x, y, coords)
*/
function solveArc(x, y, coords) {
var rx = coords[0]
var ry = coords[1]
var rot = coords[2]
var large = coords[3]
@akidee
akidee / Levenshtein revisited - more memory friendly
Created August 16, 2010 20:17
More memory friendly Levenshtein distance for JavaScript
require('benchmarks.js/index');
Array.prototype.clone = function () {
return this.slice(0);
};
/**
* Original Levenshtein implementation by Andrea Giammarchi
* See http://webreflection.blogspot.com/2009/02/levenshtein-algorithm-revisited-25.html
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
/**
* modified from http://gist.github.com/527683
* only improve slightly to get small
*/
var ie = function(v, p, needle, undef) {
needle = p.getElementsByTagName('br');
while(
p.innerHTML = '<!--[if gt IE ' + (++v) + ']><br><![endif]-->',
@xeoncross
xeoncross / default.loc
Last active December 6, 2020 18:34
default nginx + php-fastcgi vhost (win/linux)
# Creates unlimited ".loc" domains as long as you add the
# entry to /etc/hosts and create the matching $host folder
server {
listen 80 default;
server_name _;
root /home/user/www/$host;
index index.html index.php;
# Directives to send expires headers and turn off 404 error logging.
#location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
<?php
// Define the 'class' class
$class = Obj()
->fn('new', function ($class) {
$newClass = Obj($class->methods)
->fn('new', function($class) {
$obj = Obj($class->imethods);
$args = func_get_args();
array_shift($args);