Skip to content

Instantly share code, notes, and snippets.

@denitram
denitram / bash_handy
Last active December 28, 2017 12:02
bash handy tips
#--- Commandline history substitution
* Replace old by new in prevous command
^old^new
^old^new is equivalent to !!:s/old/new
* Replace globally
!!:gs/old/new
#--- Batch renaming file
@Raisi
Raisi / polarToCartesian.js
Created July 14, 2016 14:24
Transform Polar to Cartsian Coordinats
/**
* Coordinates Transformations
*
* http://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle
*
* @param centerX
* @param centerY
* @param radius
* @param angleInDegrees
* @returns {string}
@cevherkarakoc
cevherkarakoc / cartesianToPolar.js
Created July 13, 2016 13:48
Converting cartesian coordinates to polar coordinates
function cartesianToPolar(x,y){
return {
radius: Math.sqrt( Math.pow(x, 2) + Math.pow(y, 2) ),
alpha: Math.atan2(y, x)
}
}
@cevherkarakoc
cevherkarakoc / polarToCartesian.js
Created July 13, 2016 13:35
Converting polar coordinates to cartesian coordinates
function polarToCartesian(radius,radian){
return {
x:radius*Math.cos(radian),
y:radius*Math.sin(radian)
}
}
@davidperezgar
davidperezgar / comand.txt
Created July 10, 2016 21:44
remove .DS_Store from zip in Mac
zip -d archive.zip "*/*.DS_Store"
@StephenPunwasi
StephenPunwasi / gist:95cd8d77b0a1a956b07cda99ef098af6
Created April 25, 2016 14:12
Exclude OS X .DS_Store and Git files when zipping.
zip -r [filename.zip] [foldername] -x "*.DS_Store" -x *.git*
@yakovsh
yakovsh / 2007_07_25-djvu2pdf.sh
Created January 24, 2016 05:05
Converting from DJVU to PDF
#!/bin/sh
#
# Here is the software that is needed for the conversion to take place:
# 1. DjVuLibre .
# 2. LibTiff .
#
# NOTE: The ddjvu utility has an option to convert specific layers. One common mistake is to convert only the mask layer
# or the foreground layer . Technically speaking, the mask layer is the one that should have the actual text but in
# practice I have seen that the the DjVu encoder occasionally puts portions of the text in the background layer. Thus,
# if you only take the foreground or mask layers, you will lose those bits in the background. If your specific files
@dardo82
dardo82 / mkicns.sh
Last active February 2, 2016 01:39
Make ICNS from PNG
#!/bin/zsh
#mkicns.sh
FN=${1##*/}
DN=${1%/**}
BN=${FN%.*}
IS=iconset
ID=$BN.$IS
@stefanschmidt
stefanschmidt / djvu2png.sh
Last active June 16, 2016 06:54
Convert a DJVU document to numbered PNG images
# depends on djvulibre and graphicsmagick compiled with libtiff support (available via Homebrew)
ddjvu -format=tiff doc.djvu img.tiff
gm convert img.tiff +adjoin img%03d.png
@andrewwoods
andrewwoods / js-oop-example.txt
Created May 22, 2015 20:25
JS OOP inheritance idea
Source URL http://www.sitepoint.com/simple-inheritance-javascript/
This article makes inheritance in OOP easy to understand.
It did get me thinking. In the article above, the author uses
var inheritsFrom = function (child, parent) {
child.prototype = Object.create(parent.prototype);
};