Skip to content

Instantly share code, notes, and snippets.

View fariswd's full-sized avatar

Faris Widyantho fariswd

View GitHub Profile
@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()
[
{
"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 / index.js
Last active March 8, 2019 08:56
immutable groceries
// js
const groceries = {
fruit: ['apple', 'orange', 'grapes'],
};
const newGroceries = {
...groceries,
fruit: [
...groceries.fruit,
@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']);
void main() {
Map groceries = {
'fruit': ['apple', 'orange', 'grape'],
};
Map addVegetable = Map.addAll(groceries)..add({'vegetable': ['carrot', 'tomato']});
print(addVegetable);
@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() {
<!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 / 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 [email protected]: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