Skip to content

Instantly share code, notes, and snippets.

View cmd-save's full-sized avatar

Beast Node cmd-save

  • Nature Inc.
  • Earth
View GitHub Profile
var arrayObj=[
{name:'Aaron',age:20},
{name:'Michael',age:15},
{name:'Meriam',age:18}
]
function compare(a,b) {
if (a.age < b.age)
return -1;
if (a.age > b.age)
@cmd-save
cmd-save / NodeJsStarter.md
Created September 26, 2016 11:20
NodeJs Starter

What is NodeJs

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Features of Node.js

Following are some of the important features that make Node.js the first choice of software architects.

Asynchronous and Event Driven − All APIs of Node.js library are asynchronous, that is, non-blocking. It essentially means a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call.

Very Fast − Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution.

@cmd-save
cmd-save / reactjsStarter.md
Created September 27, 2016 08:24
About ReactJS

Why React?

React is a JavaScript library for creating user interfaces by Facebook and Instagram. Many people choose to think of React as the V in MVC.

We built React to solve one problem: building large applications with data that changes over time.

Simple

Simply express how your app should look at any given point in time, and React will automatically manage all UI updates when your underlying data changes.

@cmd-save
cmd-save / .eslintrc.js
Created March 28, 2017 03:49 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@cmd-save
cmd-save / settings.json
Created March 29, 2017 09:19
SublimeLinter Settings
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"eslint": {
@cmd-save
cmd-save / .eslintrc.js
Last active October 11, 2018 01:57
Eslint config
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"nconf": true
},
"parser": "babel-eslint",
@cmd-save
cmd-save / example1.js
Created August 23, 2017 15:20
example1
var animal = 'dog';
function whatAnimal() {
console.log(animal); // undefined (not dog)
var animal = 'cow';
console.log(animal); // cow
}
@cmd-save
cmd-save / example2.js
Created August 23, 2017 15:28
example2
hello(); // Hello there
function hello() {
console.log("Hello there");
}
@cmd-save
cmd-save / python2.7.md
Last active October 25, 2017 09:37
Install python 2.7 on Linux

Nodejs/NPM don't work well yet with python 3. Here's how to solve it.

Install Python 2.7

wget --no-check-certificate https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
tar -xzf Python-2.7.11.tgz  
cd Python-2.7.11

./configure 
@cmd-save
cmd-save / chase.js
Created March 14, 2018 14:33
Chase
function sort(arr) {
return arr.slice().sort(function(a,b){return a.ranking-b.ranking})
}
function average(arr) {
let sum = 0
arr.forEach((item)=> {
sum = sum + item.ranking
})
return sum/arr.length
}