Skip to content

Instantly share code, notes, and snippets.

View bobrik's full-sized avatar

Ivan Babrou bobrik

View GitHub Profile
@bobrik
bobrik / sync.js
Created May 14, 2013 13:37
does anyone know an npm module for this?
(function() {
var func, started;
function sync(fn) {
var running = false,
requested = [];
return function me(callback) {
if (running) {
requested.push(callback);
% node
> url = require("url")
> url.format({protocol: "http:", host: "google.com", port: 123})
'http://google.com'
@bobrik
bobrik / result.txt
Created May 22, 2013 12:27
phpstorm js hits bug
we're good!
we're good!
we failed
/Users/bobrik/projects/backpack-coordinator/test6.js:8
throw error;
^
Error: three
at /Users/bobrik/pew/test.js:23:9
at Object.<anonymous> (/Users/bobrik/pew/test.js:24:3)
(function() {
var http = require("http"),
child = require("child_process"),
url = require("url"),
stream = require("stream");
http.createServer(function(req, res) {
var params = url.parse(req.url, true),
args = params.query.args ? JSON.parse(params.query.args) : [],
cmd = params.pathname.substr(1),
@bobrik
bobrik / checher.php
Last active August 27, 2018 10:23
Geonames duplicate finder
<?php
// download some country file (RU.zip for example), unzip it and run:
// php -d memory_limit=512M -f checker.php ~/RU.txt RU
// summary will appear in stderr, actual duplicates in stdout
if (count($argv) < 3) {
fwrite(STDERR, "please specify path to file with cities and country code\n");
exit(1);
}
@bobrik
bobrik / example_test.go.diff
Created January 11, 2014 12:18
goes example_test.go changes
diff --git a/example_test.go b/example_test.go
index c800734..1e97f9e 100644
--- a/example_test.go
+++ b/example_test.go
@@ -2,16 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package goes_test
+package goes
package main
import "flag"
import "os"
import "strconv"
import "fmt"
var port *int
func init() {
{
"geos" : {
"mappings" : {
"point" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
{
"static_field": 5,
"another_pretty_static_field": [1,2,5,6],
"my_name_is_so_random_hahahah": 8
}
[~] % curl -s http://archive.apache.org/dist/mahout/0.9/mahout-distribution-0.9-src.tar.gz | gunzip | fgrep -a cwiki
* https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular+Value+Decomposition
* <a href=https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular+Value+Decomposition>stochastic
See https://cwiki.apache.org/MAHOUT/quickstart.html
https://cwiki.apache.org/confluence/display/MAHOUT/How+To+Contribute