Skip to content

Instantly share code, notes, and snippets.

View manolingam's full-sized avatar
🎖️
Building

Mano manolingam

🎖️
Building
View GitHub Profile
{
"name": "test-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest" //change this line
},
"keywords": [],
"author": "",
@manolingam
manolingam / index.js
Created June 21, 2019 13:02
Metamask-Web3 Access
// If privacy is turned off in Metamask
window.addEventListener('load', () => {
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
console.log("Success")
} else {
console.log('No web3? You should consider trying MetaMask!');
web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'));
}
});
@manolingam
manolingam / Sync gh-pages + master branches
Created May 2, 2019 02:00 — forked from mandiwise/Sync gh-pages + master branches
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@manolingam
manolingam / findEarth.js
Last active April 16, 2019 08:36
Finding Earth
let planets = ['mercury', 'venus', 'earth', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune', 'pluto']
function findEarth(array) {
let t0 = performance.now()
for (let i = 0; i < array.length; i++) {
if (array[i] === 'earth') {
console.log("Found Earth")
}
}
let t1 = performance.now()