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 io from 'socket.io-client' | |
import { bindActionCreators } from 'redux' | |
import store from '../redux/store' | |
import * as Actions from '../redux/actions.js' | |
const actions = bindActionCreators(Actions, store.dispatch) | |
const socket = io('http://localhost:3002') |
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 s = require('../schema/todo') | |
module.exports = function(socket) { | |
const allTodosPag = query => { | |
graphql(s.schema, query, s.root) | |
.then(res => { |
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 { buildSchema } = require('graphql') | |
const DB = require('../core/my_db/DB') | |
const schema = buildSchema(` | |
type Todo { | |
id: ID! | |
content: String! | |
completed: Boolean! | |
} |
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 mysql = require('mysql2') | |
class DB { | |
constructor() { | |
this.pool = null | |
} | |
setOptions(options) { | |
this.pool = mysql.createPool(options) | |
} |
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 { ADD_TODO, | |
TOGGLE_TODO, | |
SET_ALL_TODOS, | |
ADD_TODO_R, | |
DEL_TODO } from '../actionTypes.js' | |
const initialState = { | |
allIds: [], | |
byIds: {}, |
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
'use strict'; | |
const fs = require('fs'); | |
const Table = require('./Table'); | |
const Log = require('../../model/Log'); | |
class DB { | |
constructor() { | |
this.pool = null; | |
this.tablesNameArray = []; |
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
'use strict'; | |
const uuid = require('uuid'); | |
function getJoin(joins, tableName) { | |
let output = ''; | |
if (Array.isArray(joins)) { | |
joins.forEach((item) => { | |
output += `${item[0]} JOIN ${item[1]} ON ${tableName}.${item[2]} = ${item[1]}.${item[3]} `; | |
}); | |
} |
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
// check file or directory existance in async an sync way | |
const fs = require('fs') | |
// sync | |
if (fs.statSync(`${__dirname}/package.json`).isFile()) { | |
console.log('sync: file'); | |
} | |
if (fs.statSync(`${__dirname}/.`).isDirectory()) { | |
console.log('sync: directory'); |
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
// A vector type | |
// Write a class Vec that represents a vector in two-dimensional space. It takes | |
// x and y parameters (numbers), which it should save to properties of the same | |
// name. | |
// Give the Vec prototype two methods, plus and minus , that take another | |
// vector as a parameter and return a new vector that has the sum or difference | |
// of the two vectors’ ( this and the parameter) x and y values. | |
// Add a getter property length to the prototype that computes the length of | |
// the vector—that is, the distance of the point (x, y) from the origin (0, 0). |
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 React from 'react' | |
import './libs/jquery-ui-layout/jquery-ui-layout.css' | |
// import './css/style.css' | |
// import './css/style.css' | |
// import $ from './libs/jquery-v1.9.0.js' | |
class Chat extends React.Component { | |
constructor(props) { |
NewerOlder