Skip to content

Instantly share code, notes, and snippets.

View nodech's full-sized avatar

Nodar Chkuaselidze nodech

  • Tbilisi, Georgia
View GitHub Profile
snail = function(arr) {
var top, bottom, left, right;
if (arr.length === 0) return [];
if (arr.length === 1) return arr[0];
top = arr.shift();
bottom = arr.pop().reverse();
right = [];
left = [];
@nodech
nodech / Valid braces
Created May 12, 2014 07:56
Valid Braces Or Anything you wish in OPEN_SYMBOLS
function validBraces(braces){
var CLOSE_STACK = [],
CLOSE_SYMBOLS = '}])'.split(''),
OPEN_SYMBOLS = { '{' : '}', '[' : ']', '(' : ')' };
for(var i = 0; i < braces.length; i++) {
if (CLOSE_SYMBOLS.indexOf(braces[i]) > -1 && CLOSE_STACK.pop() !== braces[i])
return false;
else
CLOSE_STACK.push(OPEN_SYMBOLS[braces[i]]);
@nodech
nodech / index.html
Created July 30, 2014 13:33
How to update this data and redraw everything properly ? )
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Besier Curve</title>
<style>
circle {
cursor: pointer;
}
@nodech
nodech / index.html
Created July 30, 2014 19:36
Note Comments, why index variable (i) is zero after selection in `positionPoints` section ?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Besier Curve</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="main.js"></script>
@nodech
nodech / test.js
Created December 25, 2014 15:13
Maybe
var users = [];
users = socket.Observable
.on('connect')
.map(function (socket) {
return socket;
})
.until(function () {
return users.length != 10;
'use strict';
%HERE%
#!/usr/bin/env ruby
# Factorials
def fact(n)
return 1 if n == 1
fact(n - 1) * n
end
def factReduce(n)
<?php
include 'wp-includes/class-phpmailer.php';
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'From Name');
$mail->addAddress('to@example.com', 'To Name');
$mail->Subject = 'Subject';
$mail->msgHTML( 'Hello ..., ...' );
$status = $mail->send();
var asaki = 0;
if (asaki < 5) {
console.log("პატარა ხარ ძალიან!");
} else if (asaki < 12) {
console.log("მხოლოდ მშობლების ნებართვით!");
} else if (asaki < 20) {
console.log("კარგები ხართ!");
} else {
console.log("უფროსებისთვის უკეთესი ალტერნატივა გვაქვს.");
@nodech
nodech / test.js
Created May 13, 2016 21:07
Test benchmarks
var o = {};
for (var i = 0; i < 100; i++) {
o['key' + i] = 'value ' + i;
}
exports.compare = {
//#3
"for(var .. in ..)" : function () {
for(var key in o) {