Skip to content

Instantly share code, notes, and snippets.

View liesislukas's full-sized avatar
🚀
Excited

Lukas Liesis liesislukas

🚀
Excited
View GitHub Profile
import React from 'react';
import {green500} from 'material-ui/styles/colors';
import FlatButton from 'material-ui/FlatButton';
import ContentSave from 'material-ui/svg-icons/content/save';
import TextField from 'material-ui/TextField';
class TextEditOnClick extends React.Component {
constructor() {
super();
this.state = {show_input: false, valid: true};
let database = window.firebase.database();
// go offline if incomes more events per second from firebase
let events_buffer = 0;
let online = true;
const go_online = () => {
if (events_buffer > 6) {
/*
- Get SVG from https://design.google.com/icons/
- Change lines 31-32 with icon's path
*/
import React from 'react';
class IconDone extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
@liesislukas
liesislukas / .eslintrc
Created September 15, 2016 05:05
create .eslintrc file on root project dir and enable ESLint in IDE
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"console": true,
"db": true
},
import {config} from './../config/config';
const firebase = require('firebase');
const moment = require('moment');
const recursive = require('recursive-readdir');
const fs = require('fs');
const numeral = require('numeral');
firebase.initializeApp({
databaseURL: config.firebase.db_name,
serviceAccount: './config/firebase.json'
const ReactGA = require('react-ga');
ReactGA.initialize('UA-00000000000-1');
const _route_change_handler = (location) => {
ReactGA.set({page: location.pathname});
ReactGA.pageview(location.pathname);
};
export default (
<Route
/*
To enable google analytics with autotracker do these steps:
1. Add analytics script to head, i used <Helmet /> so one more entry to scripts array:
{async: true, src: 'https://www.google-analytics.com/analytics.js'},
2. add code below to routes.js
P.s. to generate static files this line is added, because document obj. is missing at that moment.
@liesislukas
liesislukas / h2load_installation.sh
Created November 9, 2016 21:52 — forked from hedleysmith/h2load_installation.sh
Installing nghttp2 & h2load on Ubuntu 14.04
#! /bin/bash
sudo apt-get update
sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev -y
git clone https://github.com/nghttp2/nghttp2.git && cd nghttp2
autoreconf -i
automake
autoconf
./configure --enable-apps
make
@liesislukas
liesislukas / 00.howto_install_phantomjs.md
Created February 24, 2017 07:28 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@liesislukas
liesislukas / gist.js
Last active April 24, 2017 14:55
normalized levenshtein to get % of match between 2 strings. 1 = 100%, 0 = 0%
let levenshtein = function (str1, str2) {
let current = [], prev, value;
for (let i = 0; i <= str2.length; i++)
for (let j = 0; j <= str1.length; j++) {
if (i && j)
if (str1.charAt(j - 1) === str2.charAt(i - 1))
value = prev;
else
value = Math.min(current[j], current[j - 1], prev) + 1;