Skip to content

Instantly share code, notes, and snippets.

View ZeroX-DG's full-sized avatar
💭
I may be slow to respond.

Nguyen Viet Hung ZeroX-DG

💭
I may be slow to respond.
View GitHub Profile
@ZeroX-DG
ZeroX-DG / complex.js
Last active May 5, 2017 17:25
Complex code
function getData(text){
if(text.split(" ")[0] == "calc"){
return text.split(" ")[1].split("_")[0] - text.split(" ")[1].split("_")[1];
}
else{
return false;
}
}
if(getData("calc 2_1")){
function getData(text){
var commandAndArgs = text.split(" ");
var command = commandAndArgs[0];
var args = commandAndArgs[1];
var arrayOfArgs = args.split("_");
var arg1 = arrayOfArgs[0];
var arg2 = arrayOfArgs[1];
if(command == "calc"){
return arg1 - arg2;
}
for(var i = 1; i < 30; i++){
console.log(i % 15 == 0 ? "FizzBuzz" : i % 3 == 0 ? "Fizz" : i % 5 == 0 ? "Buzz" : i);
}
for(var i = 1; i < 30; i++){
if(i % 15 == 0){
console.log("FizzBuzz");
}
else if(i % 3 == 0){
console.log("Fizz");
}
else if(i % 5 == 0){
console.log("Buzz");
}
for(var i = 1; i < 30; i++){
console.log((i % 3 ? x = '' : 'Fizz')+(i % 5 ? x: 'Buzz') || x+i);
}
/*
* Lazy Line Painter
* SVG Stroke animation.
*
* https://github.com/camoconnell/lazy-line-painter
* http://www.camoconnell.com
*
* Copyright © 2013-2015 Cam O'Connell
* All rights reserved.
*
class Programmer{
public function drinkCoffee(){
System.out.print("I'm drinking....");
}
}
class BackEndProgrammer extends Programmer{
public function createBackEnd(){
System.out.print("I'm creating back-end....");
}
class AI{
public function powerUp(){
System.out.print("Fired up and ready to serve");
}
}
class CleaningAI extends AI{
public function clean(){
System.out.print("Cleaning the code...");
}
class FrontEndAndCleaningAI extends CleaningAI{ // now this AI can clean code
public function createFrontEnd(){
System.out.print("I'm creating front-end....");
}
}
const puppeteer = require('puppeteer');
(async () => {
// launch the browser
const browser = await puppeteer.launch({
headless: true // headless or non-headless
});
// open a new tab
const page = await browser.newPage();