Skip to content

Instantly share code, notes, and snippets.

@taosx
taosx / api.go
Last active April 21, 2016 15:29
Make it easy to add of new apis or replace existing ones
package main
import (
"fmt"
"log"
"net/url"
"strings"
"github.com/valyala/fasthttp"
)
@taosx
taosx / fetchpostjson.js
Last active June 24, 2016 00:41
Use fetch to HTTP json
var payload = {
to: nameTo,
by: nameBy
};
fetch('/api/love/declare', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
@taosx
taosx / index.md
Created September 23, 2016 03:18 — forked from alekseykulikov/index.md
SUIT CSS naming convention for React.js application

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 6561 lines of CSS (and just 5 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@taosx
taosx / README.md
Created October 25, 2016 00:16 — forked from FND/README.md
Falcon WSGI application with asyncio

Getting Started

$ pip install falcon
$ python3 app.py

alternatively with Gunicorn (for HTTP/1.1):

$ pip install gunicorn

$ gunicorn app:app

// Compile go with musl on archlinux
// replace musl-gcc with gcc or gcc-multilib if you don't want to compile for alpine linux
CC=$(which musl-gcc) go build --ldflags '-w -linkmode external -extldflags "-static"' main.go
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
)
@taosx
taosx / Nginx.conf
Created January 23, 2017 07:03
My configuration for nginx-php7-phpfpm and wordpress
# The user account used by the worker processes. If following along with Hosting WordPress Yourself,
# it's recommened to set this to your username, but only when running a single user access server.
user nginx;
# Set to number of CPU cores, auto will try to autodetect.
worker_processes auto;
# Maximum open file descriptors per process. Should be greater than worker_connections.
worker_rlimit_nofile 8192;
@taosx
taosx / enqueue.rb
Created March 27, 2017 20:50 — forked from hiroakis/enqueue.rb
queue implementation using MySQL
require 'mysql2-cs-bind'
def get_db
return Mysql2::Client.new(
:host => 'localhost',
:port => 3306,
:username => 'root',
:password => '',
:database => 'queue_test',
:reconnect => true,
@taosx
taosx / wpcli-su.sh
Created May 17, 2017 23:39
This is a wrapper so that wp-cli can run as the www-data user so that permissions
#!/bin/sh
# This is a wrapper so that wp-cli can run as the www-data user so that permissions
# remain correct
sudo -E -u ${USER} /usr/local/bin/wp-cli.phar $*
--with-file-aio \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \