Skip to content

Instantly share code, notes, and snippets.

View republicvirgo's full-sized avatar

Dony Putra republicvirgo

View GitHub Profile

Frontend Masters: React && Firebase (Version 2)

Contact Information

Prequisite Setup

  • A recent version of Node.js
  • npm install -g create-react-app
@republicvirgo
republicvirgo / react-cheatsheet.md
Created September 27, 2018 04:15 — forked from delibytes/react-cheatsheet.md
React & JSX Cheatsheet

React & JSX Cheatsheet

Overview
JSX HTML <div>...</div>
JSX Component <Component property={javascript} />
<Component property='string' />
JSX Component with Children <Component>{children}</Component>
reference: props.children
Escaping JavaScript {...}
require statements const React = require('react');
const ReactDOM = require('react-dom');
npm modules react, react-dom
@republicvirgo
republicvirgo / react-lifecycle-cheatsheet.md
Created September 27, 2018 04:15 — forked from bvaughn/react-lifecycle-cheatsheet.md
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@republicvirgo
republicvirgo / .gitconfig
Created February 27, 2018 03:55 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
@republicvirgo
republicvirgo / .gitattributes
Created February 27, 2018 03:47 — forked from dreftymac/.gitattributes
Sample Git Attributes File
# Encrypt the repository
# Remove/modify this line if the repository is meant to be open-source
*.* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.htm text
@republicvirgo
republicvirgo / .gitignore
Created February 27, 2018 03:46 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@republicvirgo
republicvirgo / gist:83b7d87292edf50727b79bd854487564
Created February 8, 2018 06:46 — forked from dcblogdev/gist:8067095
Use Google finance calculator to convert currency with php
<?php
function convertCurrency($amount, $from, $to){
$data = file_get_contents("https://www.google.com/finance/converter?a=$amount&from=$from&to=$to");
preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted);
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
return number_format(round($converted, 3),2);
}
echo convertCurrency("10.00", "GBP", "USD");
@republicvirgo
republicvirgo / webcam.html
Created October 26, 2017 07:19 — forked from ardianta/webcam.html
kode untuk menampilkan webcam dalam HTML
<div class="">
<video autoplay="true" id="video-webcam">
Izinkan untuk Mengakses Webcam untuk Demo
</video>
<button onclick="takeSnapshot()">Ambil Gambar</button>
</div>
<script>
var video = document.querySelector("#video-webcam");
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;