Skip to content

Instantly share code, notes, and snippets.

//Finds an unknown point distance L along a quadratic curve from a known point.
//Alex Pilafian 2017 - [email protected] - github.com/sikanrong
//If you reuse this code please give me attribution, my dude! I worked hard on this.
//parabola defined by ax^2 + bx + c, a and b are passed in to constructor while c is omitted because it isn't relevant to our calculations.
//u is known point x-value
//L is known length to travel down the curve for our unknown point.
//v is the unknown point x-value, once we have v we can calculate the correspondiing unknown y just by pluging it
//back into our parabola function
@Dmitra
Dmitra / README.md
Last active November 17, 2019 16:39
Mapping ellipses in geo projection

First commit

class DataController
def normalize
@result = ""
file = File.open("params", "w")
file << params[:data]
file.close
`iconv -c -f UTF-8 -t WINDOWS-1251 params > in`
`./mystem -l in out`
`iconv -c -f WINDOWS-1251 -t UTF-8 out > result`
file = File.open("result", "r")
@Dmitra
Dmitra / gist:6d40f7655daeaad04d354e745166c0c2
Created October 31, 2018 12:51
Get dot-separated deep keys of the object
import _ from 'lodash'
const o = {
a: 1,
b: {
c: 2
}
}
const getKeysDeep = o => (
@Dmitra
Dmitra / txt2graphml.rb
Last active August 12, 2016 06:33
convert indented text to graphml
class File
def to_string
string = ''
self.each {|line|
string << line
}
return string
end
end
@Dmitra
Dmitra / parse.js
Created May 27, 2015 09:38
bunch file processor
#!/usr/bin/env node
var fs = require('fs')
, wrench = require('wrench')
//works under linux
//, parser = require('xml2json')
, path = process.cwd()
_ = require('lodash')
var test = function(files){
@Dmitra
Dmitra / big_image_processor.js
Last active August 12, 2016 06:32
process very big images by splitting to squares
#!/usr/bin/env node
var inputFolder = './';
var ext = '.png';
var fs = require('fs')
, gm = require('gm')
, spawn = require('child_process').spawn;
//gm(inputFolder + '0-0.png')
@Dmitra
Dmitra / README.md
Last active August 12, 2016 06:39 — forked from mbostock/.block
encapsulate D3 module functionality in one object

This fork of axis example use changed D3's axis component. The goal of rewrite is to incapsulate all module functionality in one object.