Skip to content

Instantly share code, notes, and snippets.

@kosamari
kosamari / check_file_extention.js
Last active August 29, 2015 14:04
script for file extention verification
/*
script for file extention verification
*/
var path = 'path/to/file';
var imageExt = ['jpeg','jpg','png','gif','tiff']; //specify allowed file extentions
var fileExt = path.split('.');
var checkExist = imageExt.indexOf(fileExt[fileExt.length-1]); // -1 if the file extention does not exist in imageExt
if (checkExist === -1){
console.log('File type not supported, please use '+ imageExt);
@kosamari
kosamari / phantomjs-node_console_output.js
Last active August 29, 2015 14:04
code to out put console message in phantomjs page into node.js console.
/*
code to out put console message in phantomjs page into node.js console.
*/
page.set('onConsoleMessage', function (message) {
console.log('Phantom Console: ' + message);
});
@kosamari
kosamari / phantom-node_callback.js
Last active August 29, 2015 14:04
allows to call function from inside of page.evaluate in phantomjs-node
/*
allows to call function from inside of page.evaluate in phantomjs-node
*/
page.set('onCallback', function (arg) {
//callback actions
});
//To use callback, use following command in your page.evaluate
window.callPhantom(arg);
@kosamari
kosamari / index.html
Last active August 29, 2015 14:07
D3 arc clock
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
path.overlay {
fill: orange;
}
path.base{
fill: #f3f3f3;
@kosamari
kosamari / index.html
Created October 13, 2014 23:47
D3 Line clock
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
rect.overlay {
fill: #2279bd;
}
rect.base{
fill: #f3f3f3;
@kosamari
kosamari / city.json
Created October 28, 2014 19:58
D3 Map with Data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kosamari
kosamari / index.html
Created November 20, 2014 23:11
Brooklyn JS Anniversary
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
<style>
body {
background: #222;
color:#fff;
font-family: "Helvetica Neue", Helvetica, sans-serif;
@kosamari
kosamari / DecimalHexBinary
Created April 27, 2015 04:35
Decimal/Hex/Binary
| Decimal | Hex | Binary |
|---------|-----|----------|
| 0 | 00 | 00000000 |
| 1 | 01 | 00000001 |
| 2 | 02 | 00000010 |
| 3 | 03 | 00000011 |
| 4 | 04 | 00000100 |
| 5 | 05 | 00000101 |
| 6 | 06 | 00000110 |
| 7 | 07 | 00000111 |

Terms I did not know and learnd over time.

Project related

  • TC
  • TC39
  • ES6 (ES5, ES3)
  • Core (about an open source project)
  • Commit bit
  • SemVer
@kosamari
kosamari / what-I-learned.md
Created June 15, 2015 13:43
What I learned from reading PRs and issues on 'What is Code?' repo

Programmers likes to fix things. When there is a typo in your code, then your code won't work. There are many requests to fix typo in the article from inconstant numbering in footnotes to wrong filename for images. When spotting someone's mistake, get creative and title your PR like "Instagram is only worth 1 Instragram not 2 Instragrams". Programmer's attention to detail extends not only the article itself, but also the license doc in the repo.

Don't forget to fact check before spotting mistake though. It's important. Keyword to use is AFAIK and can confirm.

Programmers love to know the source of information. There are few requests to add hyperlinks to contents referenced in the article. Some are from original autho