Skip to content

Instantly share code, notes, and snippets.

View ryanhs's full-sized avatar

ryan hs ryanhs

  • PT Astra Internasional
  • Jakarta
View GitHub Profile
@ryanhs
ryanhs / CORS.php
Last active August 14, 2016 16:36
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
@ryanhs
ryanhs / virtualenv-auto.sh
Created May 19, 2017 04:03
execute something when entering directory added on .bashrc
# virtualenv auto activation
function cd {
builtin cd "$@"
DEACTIVATE_TYPE="function";
DEACTIVATE_EXIST=$(type -t deactivate);
if [ -d ".venv" ]
then
source .venv/bin/activate #auto activate
else
if [ "$DEACTIVATE_EXIST" == "$DEACTIVATE_TYPE" ]; then deactivate; fi #auto deactivate
@ryanhs
ryanhs / ubuntu-cli-install-android-sdk.sh
Created November 19, 2017 07:36 — forked from zhy0/ubuntu-cli-install-android-sdk.sh
Install Android SDK on headless Ubuntu linux machine via command line, so that you can compile open source Android apps.
#!/bin/bash
# Thanks to https://gist.github.com/wenzhixin/43cf3ce909c24948c6e7
# Execute this script in your home directory. Lines 17 and 21 will prompt you for a y/n
# Install Oracle JDK 8
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
apt-get install -y unzip make # NDK stuff
@ryanhs
ryanhs / README.md
Last active December 2, 2017 00:05
ZComponent - A Glue for React and Airbnb/Polyglot.js

ZComponent

A Glue for React and Airbnb/Polyglot.js

Why

This is a glue for react and Airbnb polyglot.

Why make polyglot in every component? Simply. Because of Component in atomic level should be stateless. (without flux).

@ryanhs
ryanhs / user agents.txt
Created December 5, 2017 02:39
user agents
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
@ryanhs
ryanhs / .env.example
Last active December 8, 2017 22:00 — forked from joelbowen/README.md
create-react-native-app environment variables
REACT_NATIVE_APP_NAME="Your App Name"
@ryanhs
ryanhs / gist:0ff46f16c3c6a08bd5ef84d45f61aed0
Created February 19, 2018 06:32 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@ryanhs
ryanhs / express.js
Last active May 5, 2018 17:29
Loki JS for big data, benchmark
const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;
const express = require('express');
const loki = require('lokijs');
var app = express();
var db = new loki('test');
@ryanhs
ryanhs / tele notif.sh
Created May 20, 2018 15:01
tele notif example
#!/bin/bash
notify() {
user_id=<your tele id>
bot_token=<your tele bot token>
message=$1
curl --data chat_id="${user_id}" \
--data "text=${message}" \
"https://api.telegram.org/bot${bot_token}/sendMessage"
}
@ryanhs
ryanhs / laravel datatable cacher.php
Last active June 12, 2018 08:38
laravel datatable cacher
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class BrowseController extends Controller
{
// dattable cacher