Skip to content

Instantly share code, notes, and snippets.

View siberex's full-sized avatar
🛠️
Your stack will not be full without me

Stepan Legachev siberex

🛠️
Your stack will not be full without me
View GitHub Profile
@siberex
siberex / Text loading spinner animation
Last active August 29, 2015 14:01
Simple text loading spinner (., .., ...). Replace 3 with whatever you want (as long as it equals power of two − 1 ^_^) to get more dots :-)
var tSpinnerState = 3|0;
setInterval(function() {
$(".tspinner").text(
new Array( (++tSpinnerState, tSpinnerState &= 3) + 1 ).join(".")
);
}, 275);
لُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ
@siberex
siberex / coroutine.php
Created November 19, 2012 15:33 — forked from nikic/coroutine.php
A coroutine example: Streaming XML parsing using xml_parser
<?php
error_reporting(E_ALL);
/* Data can be send to coroutines using `$coroutine->send($data)`. The sent data will then
* be the result of the `yield` expression. Thus it can be received using a code like
* `$data = yield;`.
*/
/* What we're building in this script is a coroutine-based streaming XML parser. The PHP
@siberex
siberex / vk-noround.css
Last active August 25, 2016 09:47
VK.com: Get rid off rounded images
/*
VK.com: Get rid off rounded images
User CSS extension for Chrome:
https://chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb/related?hl=en
*/
.nim-peer--photo-w,
.post_img, .reply_img, .cell_img,
.fl_l.thumb,
@siberex
siberex / clone-tree.sh
Created August 25, 2016 21:57
Clone tree structure
# http://ilyabirman.ru/meanwhile/all/clone-directory-structure/
SRC='/Volumes/My Passport/Porno/'
DEST='/tmp'
find "$SRC" -type f | while read f; do mkdir -p "$(dirname "$DEST$f")" && touch "$DEST$f"; done
@siberex
siberex / geo-points-distribute-nearby.js
Last active September 13, 2016 06:35
Random locations nearby specified location limited by radius
/**
* Get random geo point [latitude, longitude] within some distance from specified geo point (lat, long)
*
* Points will be uniformly-distributed on multiple calls.
*
* → Demo is here: http://jsfiddle.net/siberex/f72ffn1x/
*
* @param lat Latitude in degrees
* @param lng Longitude in degrees
* @param distance Distance in meters to limit point distribution to.
"use strict";
const rp = require('request-promise');
const util = require('util');
// https://developers.google.com/maps/documentation/timezone/start#get-a-key
let apiKey = 'AIzaSyCFljyx_4s3t6ldM5alxXPqcD7P9X6TYUM';
let coords = [[-22.681019,14.522226],[2.5724996,-27.8163698],[4.557567,4.6163235],[4.4254036,8.790334],[0.344051,9.4742473],[0.3834557,9.4475747],[-20.4457012,57.7176283],[0.3757385,9.4549369],[3.0552875716039662,9.964265981535153],[0.3546091,9.4734645],[89.9999999999996,0],[0.4093177,9.4320854],[0.470328,9.398915],[0.391981,9.4431912],[-1.1482112,8.6987966],[7.3679758,-24.2785494],[11.0904651,-28.864397],[0.40260293,9.43583089],[4.2393411,8.405862],[-22.008171379566193,35.3210552316159],[0.3718994,9.4592005],[6.3413884,3.3973382],[4.0709123,9.7037695],[4.9128139,-1.737505],[-20.174795,57.770134],[0.3711196,9.4582866],[0.3836682,9.4472672],[26.2327904,50.5381572],[-20.17276879,57.77063021],[-20.0052654,57.5698832],[4.443256666666667,8.027361666666668],[-20.28077,57.36534333333334],[41.40668
"use strict";
// node --harmony test-googleapi-async.js
const rp = require('request-promise');
const util = require('util');
const https = require('https');
// https://developers.google.com/maps/documentation/timezone/start#get-a-key
let apiKey = 'AIzaSyCFljyx_4s3t6ldM5alxXPqcD7P9X6TYUM';
@siberex
siberex / ng.location.test.html
Last active November 11, 2016 09:40
AngularJS location provider example
<!doctype html>
<html lang="en"
xmlns:ng="http://angularjs.org" id="ng-app" ng-app="awesomeApp"
ng-strict-di="">
<head>
<title>Location test</title>
<base href="/ng.location.test.html/">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
"use strict";
const co = require('co');
co(function* () {
let test = function(value) {
return new Promise((resolve, reject) => {
if (value) {
resolve(value);