This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cartesianToPolar(x,y){ | |
return { | |
radius: Math.sqrt( Math.pow(x, 2) + Math.pow(y, 2) ), | |
alpha: Math.atan2(y, x) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function polarToCartesian(radius,radian){ | |
return { | |
x:radius*Math.cos(radian), | |
y:radius*Math.sin(radian) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zip -d archive.zip "*/*.DS_Store" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zip -r [filename.zip] [foldername] -x "*.DS_Store" -x *.git* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
#mkicns.sh | |
FN=${1##*/} | |
DN=${1%/**} | |
BN=${FN%.*} | |
IS=iconset | |
ID=$BN.$IS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; | |
NewerOlder