Skip to content

Instantly share code, notes, and snippets.

View fariswd's full-sized avatar

Faris Widyantho fariswd

View GitHub Profile
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@Xaekai
Xaekai / ipc.example.js
Created July 11, 2016 18:12
Example of Interprocess communication in Node.js through a UNIX domain socket
/*
**
** Example of Interprocess communication in Node.js through a UNIX domain socket
**
** Usage:
** server> MODE=server node ipc.example.js
** client> MODE=client node ipc.example.js
**
*/
@kyo504
kyo504 / index.ios.js
Created April 12, 2017 16:38
Store base64 image with AsyncStorage
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
View,
ImageStore,
Image,
ImageEditor,
AsyncStorage,
Button,
@IgorMing
IgorMing / barcodescanner.js
Last active April 13, 2023 19:52
Barcode Scanner on React Native (with expo), stylized with opaque edges
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { BarCodeScanner } from 'expo';
export default class App extends React.Component {
render() {
return (
<BarCodeScanner
onBarCodeRead={(scan) => alert(scan.data)}
style={[StyleSheet.absoluteFill, styles.container]}
function createHash() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 32; i++)
text += possible.charAt(Math.ceil(Math.random() * possible.length));
return text;
}
@cereallarceny
cereallarceny / index.js
Created October 12, 2017 20:37
Server-side rendering with create-react-app (Fiber), React Router v4, Helmet, Redux, and Thunk
// Ignore those pesky styles
require('ignore-styles');
// Set up babel to do its thing... env for the latest toys, react-app for CRA
require('babel-register')({
ignore: /\/(build|node_modules)\//,
presets: ['env', 'react-app']
});
// Now that the nonsense is over... load up the server entry point
@akbarsahata
akbarsahata / index.html
Created November 23, 2017 04:27
miracle-fox vue component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hacktiv8 Job Boards</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
</head>
@akbarsahata
akbarsahata / news-item.js
Created November 23, 2017 04:29
miracle-fox vue component
Vue.component('news-item', {
template: `
<div class="panel panel-default">
<div class="panel-heading">
{{article.title}}
</div>
<div class="panel-body">
<img :src="article.urlToImage" class="img-responsive img-thumbnail">
<p>{{article.description}}</p>
<input type="text" v-model="article.title" />
// Gradle script for detached apps.
import org.apache.tools.ant.taskdefs.condition.Os
void runBefore(String dependentTaskName, Task task) {
Task dependentTask = tasks.findByPath(dependentTaskName);
if (dependentTask != null) {
dependentTask.dependsOn task
}
}
@lantip
lantip / save_screenshot.py
Last active May 17, 2019 05:58
Script untuk menyimpan tangkap-layar dari laman KPU.
# Script ini hanyalah proof of concept untuk menyimpan laman satu website per 5 detik
# Script semacam ini sudah dibuktikan cara kerjanya oleh pak Budi Rahardjo di https://www.youtube.com/watch?v=DYlgavNY9LE
# Untuk menjalankan script ini dibutuhkan python3 dan library selenium dengan chromedriver
# POC ini hanya menyimpan 5 berkas saja. Anda bisa menambahkan sesuka Anda.
# Note: ini hanya script menyimpan screenshot, belum menjalankan fungsi seperti select input form. Itu akan ada di gist lain.
from selenium import webdriver
import time
browser = webdriver.Chrome()
browser.get('https://pemilu2019.kpu.go.id/#/ppwp/hitung-suara/')