Skip to content

Instantly share code, notes, and snippets.

View vetri02's full-sized avatar
🎯
Focusing

Vetrichelvan Jeyapalpandy vetri02

🎯
Focusing
View GitHub Profile
@vetri02
vetri02 / splitWordNumero
Created July 27, 2011 10:44
Adds number to each word in a sentence
function splitWordNumero(bar){
var foo = bar;
//var foo = "The quick brown fox jumps over the lazy dog";
var temp = [];
var res = [];
temp = foo.split(' ');
var j = temp.length;
console.log(j);
@vetri02
vetri02 / applyTest
Created August 5, 2011 19:37
Define a function named applyTest that takes two arguments, a function f and an input x. Your function should return a list that contains x, the function f on the input x, and the function f on the input 0.
var addOn = function(x){
return x+1;
};
var applyTest = function (f, x) {
return [x, (f(x)), (f(0))];
};
var y = applyTest(addOn, 1);
@vetri02
vetri02 / generate
Created August 7, 2011 11:33
Define a function named generate that takes one argument, a function f. It should return an array that consists of the function f and another function that doubles its input.
var generate = function (f) {
var double = function(x) {
return x * 2;
};
return [f, double];
};
var t = function() {return true;};
@vetri02
vetri02 / bf.js
Created August 21, 2012 10:04
for loop in JS using special characters
var l = +!+[];
for(var i = +[];i <= !+[]+!+[]; i++){
l = l+(+!+[]);console.log(l);
}
@vetri02
vetri02 / arrErr.js
Created October 7, 2012 17:00
Find Issue in FF
var fg = function(s){
var d = s+1;
return d;
};
var callFunc = function (f) {
var i,arr;
arr = [];
for(i=0;i<1;i+1){
arr.push(f(i));
@vetri02
vetri02 / scrap_github_explore.py
Created September 6, 2013 18:11
From Neckbeard Republic, learnt this from the web scraping section and changed the code according to new Github Explore pages
import requests
from bs4 import BeautifulSoup
GITHUB_EXPLORE_PAGE = 'https://github.com/explore'
def get_html_explore():
response = requests.get(GITHUB_EXPLORE_PAGE)
return response.content
@vetri02
vetri02 / anag.js
Created September 20, 2013 20:24
Gives back the anagram of the string thats being passed in eg. anag("abc") Result: [ 'cab', 'bca', 'abc', 'cba', 'acb', 'bac' ]
/* NEED TO PERFORMANCE TUNE */
function anag(str){
'use strict';
if(typeof str !== 'string'){
return ;
}
str = str.replace(/\s+/g, '').toLowerCase();
@vetri02
vetri02 / arrayList.js
Last active November 14, 2017 09:43
Add 100000 numbers in lines to DOM
function arrayList(array, rootDom){
var arrDom = [];
console.log(array)
var frag = document.createDocumentFragment();
for (var i=0; i < array.length; i++){
console.log(array[i]);
// arrDom.push('<p>'+array[i]+'</p>');
var p = document.createElement("p");
p.innerHTML = array[i];
frag.appendChild(p);
@vetri02
vetri02 / Heart Animation
Last active April 18, 2018 18:49
Heart Animation
Heart Animation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.