This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create(); | |
var fs = require('fs'); | |
casper.on('remote.message', function (msg) { | |
console.log('Casper Console Listener: ' + msg); | |
}); | |
casper.start('http://www.google.com/', function () { | |
this.fill('form', { q: 'hello world' }, true); // this keyword is referring to casper object | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/users', function(req, res) { | |
var user = new User({ | |
username: req.body.username | |
}); | |
user.save(function(err) { | |
if (err) { | |
if (err.name === 'MongoError' && err.code === 11000) { | |
// Duplicate username | |
return res.status(500).send({ succes: false, message: 'User already exist!' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const graphql = require('graphql'); | |
const fakeDatabase = require('./fakeDatabase'); | |
const newFake = require('./newFake'); | |
const fakeDatabaseType = new graphql.GraphQLObjectType({ | |
name: 'fakeDatabase', | |
fields: { | |
id: { type: graphql.GraphQLID }, | |
name: { type: graphql.GraphQLString }, | |
description: { type: graphql.GraphQLString }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fakeDatabase = [ | |
{ | |
id: 1, | |
name: 'Abhay', | |
description: 'This is Abhay\'s Database' | |
}, | |
{ | |
id: 2, | |
name: 'Bankimchandra', | |
description: 'This is Bankimchandra\'s Database' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const bodyParser = require('body-parser') | |
var mysql = require('mysql') | |
var alasql = require('alasql'); | |
var async = require('async'); | |
const request = require('request') | |
const app = express() | |
var json; | |
//const botBuilder = require('claudia-bot-builder'); | |
//const fbTemplate = botBuilder.fbTemplate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: http://choyan.me/oh-my-zsh-elementaryos/ | |
sudo apt-get update && sudo apt-get install -y curl vim git zsh | |
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash | |
sudo chsh -s $(which zsh) $(whoami) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers } from 'redux'; | |
export const ONLINE = `ONLINE`; | |
export const AWAY = `AWAY`; | |
export const BUSY = `BUSY`; | |
export const OFFLINE = `OFFLINE`; | |
export const UPDATE_STATUS = `UPDATE_STATUS`; | |
export const CREATE_NEW_MESSAGE = `CREATE_NEW_MESSAGE`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HelloWorld extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'Hi' }; | |
} | |
logMessage() { | |
console.log(this.state.message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const currentMonth = 8; | |
const data = [{ | |
employee: 70, | |
month: 0, | |
year: 2017, | |
id: 3, | |
createdAt: '2017-09-15T09:42:37.000Z', | |
updatedAt: '2017-09-15T09:42:37.000Z', | |
organization: 41, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Rabbit() { | |
this.jumps = "yes"; | |
}; | |
var rabbit = new Rabbit(); | |
console.log(rabbit.jumps); | |
// Rabbit.prototype.constructor is a pointer to the original constructor `function Rabbit(){..})` so that the users of the class can detect the constructor from an instance | |
console.log(Rabbit.prototype.constructor); | |
// outputs exactly the code of the function Rabbit() |
OlderNewer