Skip to content

Instantly share code, notes, and snippets.

View fariswd's full-sized avatar

Faris Widyantho fariswd

View GitHub Profile
@fariswd
fariswd / gist:3c208cb5d191a9563be8bb4cb443ba9d
Last active September 26, 2017 06:44 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@fariswd
fariswd / app.js
Created May 9, 2018 10:21
barcode scanner oppacity background
import React, { Component } from 'react';
import { Text, View, StyleSheet, Alert } from 'react-native';
import { Constants, BarCodeScanner, Permissions } from 'expo';
export default class App extends Component {
state = {
hasCameraPermission: null
};
componentDidMount() {
void main() {
Map groceries = {
'fruit': ['apple', 'orange', 'grape'],
};
Map addVegetable = Map.addAll(groceries)..add({'vegetable': ['carrot', 'tomato']});
print(addVegetable);
@fariswd
fariswd / main.dart
Last active April 14, 2019 03:08
Dart Imutable map
void main() {
Map groceries = {
'fruit': ['apple', 'orange', 'grapes'],
'vegetable': [],
};
Map addVegetable = Map()
..addAll(groceries)
..putIfAbsent('vegetable', () => ['carrot', 'tomato'])
..update('vegetable', (_) => ['carrot']);
@fariswd
fariswd / index.js
Last active March 8, 2019 08:56
immutable groceries
// js
const groceries = {
fruit: ['apple', 'orange', 'grapes'],
};
const newGroceries = {
...groceries,
fruit: [
...groceries.fruit,
[
{
"url": "https://github.com/fariswd/myxxi",
"title": "myxxi",
"desc": "Featured movie from your favorite streamsite",
"date": "2019-04-25T17:53:12Z"
},
{
"url": "https://github.com/fariswd/gogolist",
"title": "gogolist",
@fariswd
fariswd / timezone.js
Created May 29, 2019 05:23
Time UTC & Time Jakarta
import moment from 'moment'
import momenttz from 'moment-timezone'
const Timestamp = Date.now();
const timeUTC = moment(Timestamp).utc()
const timeJakarta = momenttz.tz(Timestamp, "Asia/Jakarta").format()
@fariswd
fariswd / esp32-uno-board.ino
Created February 19, 2020 09:18
predefine io board esp32 uno wemos board 1.0.0
#define A0 2
#define A1 4
#define A2 35
#define A3 34
#define A4 36
#define A5 39
#define D2 26
#define D3 25
#define D4 17
4 3 4 6# 6 5 4 6 6 5# 6
4 3 4 6 5 4 5 4 4 3 4
2 1# 2 5 4 2# 2 2# 2# 4 5
5 4# 5 1 6# 6 5 6 5# 5 4
5 6 6# 6 6 6 6 5 4 6#
__ __ __ __ __
6# 1 6# 5 6# 1 6# 6# 2 1# 1 6#
__ __ __ __