Skip to content

Instantly share code, notes, and snippets.

View anton-rudeshko's full-sized avatar
❄️
Snowflake

Anton Rudeshko anton-rudeshko

❄️
Snowflake
View GitHub Profile
function replaceUrl(key, newValue) {
var url = window.location.href,
separator = ~url.indexOf('?') ? '&' : '?',
re = new RegExp('([?&])' + key + '=(.*?)([?&]|$)', 'i'),
match = re.exec(url),
hasParam = !!match;
if (hasParam) {
if (match[2] === newValue || !newValue) {
return url.replace(re, '');
#!/usr/bin/env bash
function check_access () {
host=$1; shift
port=$1; shift
nc -zw 1 $host $port > /dev/null && echo yes || echo no
}
function set_property () {
{
"name": "web3",
"version": "0.0.1",
"dependencies": {
"bower": {
"version": "1.3.5",
"from": "bower@1.3.5",
"resolved": "https://registry.npmjs.org/bower/-/bower-1.3.5.tgz",
"dependencies": {
"abbrev": {
@anton-rudeshko
anton-rudeshko / timestamp.js
Created July 18, 2014 12:19
Detect timestamp: seconds vs. millis
var isTimeStamp = (function(MAX_INT) {
return function(number) {
return parseInt(number, 10) > MAX_INT;
};
})(Math.pow(2, 31) - 1);
@anton-rudeshko
anton-rudeshko / blogger-test.js
Created November 2, 2012 16:33
Blogger test gist
function sayHello() {
console && console.log('Hello');
}
function Person(name, age) {
this.name = name;
this.age = age;
}
var aaaa = new Person('aaaa', 12)
@anton-rudeshko
anton-rudeshko / DBConnector.java
Created November 21, 2012 12:49
АдовЪ код
public class DBConnector {
public GlobalSaver gs = new GlobalSaver();
// ...
}
public class GlobalSaver {
private static DBConnector dbc = new DBConnector();
// ...
}
@anton-rudeshko
anton-rudeshko / fun.js
Last active December 14, 2015 21:19
Всякие забавности в js
var a = [];
console.log(a == false); // true
console.log(!a == false); // true
console.log(!!a == false); // false
@anton-rudeshko
anton-rudeshko / gist:5744809
Created June 9, 2013 19:20
tracert -h 100 216.81.59.173
...
7 44 ms 47 ms 49 ms 30gigabitethernet1-3.core1.ams1.he.net [195.69.145.150]
8 56 ms 63 ms 56 ms 10gigabitethernet2-1.core1.par2.he.net [184.105.213.102]
9 134 ms 136 ms 137 ms 10gigabitethernet15-1.core1.ash1.he.net [184.105.213.93]
10 144 ms 149 ms 150 ms 10gigabitethernet1-2.core1.atl1.he.net [184.105.213.110]
11 143 ms 143 ms 143 ms 216.66.0.26
12 * * * Request timed out.
13 182 ms 183 ms 185 ms Episode.IV [206.214.251.1]
14 182 ms 183 ms 185 ms A.NEW.HOPE [206.214.251.6]
15 183 ms 183 ms 183 ms It.is.a.period.of.civil.war [206.214.251.9]
@anton-rudeshko
anton-rudeshko / version.js
Last active December 18, 2015 07:59
А как вы инкрементируете версию?
var version = '12.34';
version = (function (major, minor) {return major + '.' + (++minor); }).apply(null, version.split('.'));
console.log(version); // 12.35
<html>
<head>
<script type="text/javascript">
(function (d) {
var longTapTimer,
ael = 'addEventListener',
TAP_DELAY = 500, // ms
element = null,
onLongTap = function () {