Skip to content

Instantly share code, notes, and snippets.

View niradler's full-sized avatar
🎮

Nir Adler niradler

🎮
View GitHub Profile
const mysql = require('mysql');
const json2csv = require('json2csv');
const fs = require('fs');
const await = require('asyncawait/await');
const async = require('asyncawait/async');
var knex = require('knex')({
client: 'mysql',
connection: {
host: '*',
@niradler
niradler / ReactInput.js
Last active November 20, 2017 17:04
react input component
import React, {Component} from 'react';
class Input extends Component {
constructor(props) {
super(props);
this.state = {
value: ''
};
this.handleChange = this
.handleChange
import React, {Component} from 'react';
import Input from './Input';
class Form extends Component {
constructor(props) {
super(props);
this.state = {
fname: '',
lname: ''
};
this.fields = [
@niradler
niradler / package.json.express.api
Last active December 31, 2017 14:55
package.json for express base projects
{
"name": "company_api",
"version": "1.0.0",
"description": "company api",
"main": "index.js",
"author": "company",
"license": "ISC",
"private": true,
"scripts": {
"start": "nodemon src/index.js --exec babel-node --presets es2015,stage-2",
{
"name": "project-name",
"version": "0.0.1",
"description": "baebl simple use",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel source --presets babel-preset-es2015 --out-dir dist",
"prepublish": "npm run build"
},
const config = {
url: 'https://book-store-adonis.herokuapp.com/api',
actions: {
get:{
method: 'GET',
path: '/book/:id'
}
}
}
if (typeof require === 'undefined') {
if (!axios) {
console.log('axios is a dependency, please include it in the top of the index.html file (<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js"></script>)')
}
} else {
var axios = require('axios');
}
function Server(config) {
this.url = config.url;
if (typeof require === 'undefined') {
if (!axios) {
console.log('axios is a dependency, please include it in the top of the index.html file (<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js"></script>)')
}
} else {
var axios = require('axios');
}
function Server(config) {
this.url = config.url;
this.actions = config.actions;
for (const key in this.actions) {
Server.prototype[key] = function(param,data) {
var host = this.url.concat(this.actions[key].path);
var find_var = host.indexOf(':');
if (find_var>-1 && arguments.length>0) {
for (var i = 0; i < arguments.length; i++) {
var name=Object.getOwnPropertyNames(arguments[i])[0],
@niradler
niradler / wix_test.js
Created March 18, 2018 17:38
wix online test
// #1
const str1 = `((())))((()())(())(())((())(()()(((()((()))()()(((((((((()())(()()(((((()()))))))(())(())(()))()()))((()((()(()((()())(()())))(()(()))(()))())))()))(())()()((((((())()))))()()((()((())())((((((()())())()))((()))))()()))(((()))((((()))))))))()((((((()(((())())))()())(()))()()()())(()()))))(()))))(((()(()))(()(()())((())))(()((())(()()((()())(()))()((()()(())((((()((()))(()()))(())()((())(()())()(()()((()(()()()))()((()(()))())((()))(())(((()))(((())((()())(())(())((())()()))()((((((())(()))(((()(((((()))()(())()())))((()))))(((()(()())(())()()()))((((((())))(()((((())()())())()())(((((((((())))(()()()(((()((()((())())(((()()))(()(()((((()((()(()())))()((())()(((((()(((((()()())(()(()()((()))())((((())()()))(()(()(()(()((((())))()((((()))())()((((())))))((((()((((()(())))(()()())((()())))))(()))(())()))())(((()))())(()()))()()((())())()())((()(()())(()))()()((())((()())(()((()((())))(())()())(())(()())()()())((())()((((((())))))))))(()()((())(()))()())((())())()))((())())(((((((()(()))(((()(