Skip to content

Instantly share code, notes, and snippets.

View blenderous's full-sized avatar
🎯
Focusing

Harish Veerasekaran blenderous

🎯
Focusing
  • Chennai, India
View GitHub Profile
@blenderous
blenderous / prettify-base64.js
Last active October 19, 2022 08:09
Convert PNG image to data URI using Node.js
var fs = require('fs');
//
// reference for accessing file system using node.js
// http://www.sitepoint.com/accessing-the-file-system-in-node-js/
fs.readFile('image.png', 'binary', function(error, data) {
var buf = new Buffer(data, 'binary');
var string = buf.toString('base64');
var limit = parseInt(string.length/50);
console.log('Data url of the image.png in not more than 50 characters per line:');
console.log('');
@blenderous
blenderous / sample.json
Created January 18, 2016 11:41
Sample JSON file
[
{
"title": "Abstract",
"imageUrl": "http://lorempixel.com/640/480/abstract/1",
"description" : "Lorem ipsum dolor sit amet, vim case efficiantur ei. Mea doming oblique quaestio ne, ut eam virtute vocibus. At iusto sadipscing neglegentur vix. Melius detracto cum an. Sed te noster aeterno convenire. Id wisi nominati consequuntur sea, noluisse partiendo petentium per at."
},
{
"title": "City",
"imageUrl": "http://lorempixel.com/640/480/city/1",
"description" : "Sed et vitae constituto scriptorem, utamur maiorum duo in. Alienum perfecto tacimates mei no. Eam no forensibus democritum. No eam nibh prompta iudicabit. Eripuit appareat nec no, ea porro dissentiunt pri."
@blenderous
blenderous / en.json
Last active November 26, 2016 19:40
English and French language files that could be used with angular translate
{
"GO_TO_MENU": "Go to menu",
"GO_TO_CONTENT": "Go to content",
"ERROR_PAGE_TITLE": "Error – page not found",
"IMG_SRC": "https://gist.githubusercontent.com/blenderous/087416ad39ec9d9baa28bf72714b3333/raw/2be1184c0f056d42f2f5690bb2f86f36b7860b3e/en.png"
}
@blenderous
blenderous / generate-html.js
Last active November 29, 2016 14:08
Node module that takes markdown file as input and returns html into the log after inserting links on headings
// includes
var marked = require('marked');
var fs = require('fs');
// show me the code!
var s,
markdownShowdown = {

Front end test

A front end test intended for an entry level front-end developer

1. Create a layout like below using only CSS (difficulty level: medium)

-----------------------------------------------
|                              |              |
|  background color: yellow    |  background  |
|                              |    color:    |

| | orange |

@blenderous
blenderous / bower-maker.js
Created November 29, 2016 14:07
A CLI that takes you step by step asking what kind bower packages need to be included for your page
'use strict'
var fs = require('fs-extra');
/*
* function
* takes bower dependencies in the form of array
* and creates a bower.json
*/
module.exports = function (pageName, dependencies) {
@blenderous
blenderous / example.js
Created December 17, 2016 10:55
Code to read the file uploaded to a page (using FileReader object)
// file input
var input = document.getElementById('fileinput');
// treatment when file is selected
var handleFiles = function () {
// log the size of the file
console.log('Size of the file is ' + this.files[0].size/1000 + ' kB');
// instantiate a new FileReader object
@blenderous
blenderous / statewise-shool-information.json
Created July 12, 2017 11:43
State-wise number of Schools belonging to different categories in Rural & Urban areas as on 30th September 2009 (Data is obtained from Open Government data data.gov.in)
{"fields":[{"id":"a","label":"Sl. No.","type":"string"},{"id":"b","label":"STATE\/U.T.","type":"string"},{"id":"c","label":"Primary Schools","type":"string"},{"id":"d","label":"Upper Primary Schools","type":"string"},{"id":"e","label":"Secondary Schools","type":"string"},{"id":"f","label":"Higher Secondary Schools","type":"string"},{"id":"g","label":"Total Schools\nof Schools","type":"string"},{"id":"h","label":"Degree Colleges having Classes XI & XII","type":"string"}],"data":[["1","Andaman Nicobar Islands","207","67","45","53","372","0"],["2","Andhra Pradesh","64401","15115","17820","3220","100556","48"],["3","Arunachal Pradesh","1808","909","192","111","3020","0"],["4","Assam","31045","8954","4138","850","44987","266"],["5","Bihar","43286","22775","2700","1262","70023","494"],["6","Chandigarh","21","22","68","73","184","0"],["7","Chhattisgarh","33372","14897","1838","2627","52734","0"],["8","Dadra Nagar Haveli","181","94","17","10","302","0"],["9","Daman Diu","51","32","18","11","112","1"],["10","Delhi"