Skip to content

Instantly share code, notes, and snippets.

View banhaclong20's full-sized avatar

Tom Tran banhaclong20

View GitHub Profile
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@banhaclong20
banhaclong20 / destructuring.js
Created September 21, 2017 22:33 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@banhaclong20
banhaclong20 / .eslintrc
Created January 16, 2018 03:28 — forked from radiovisual/.eslintrc
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
import serializeForm from 'form-serialize'
const getLocalStorage = (key) => {
let data = null
try { data = JSON.parse(localStorage[key]) } catch() {}
return data
}
const setLocalStorage = (key, data) => {
localStorage[key] = JSON.stringify(data)
@banhaclong20
banhaclong20 / searchkit-update-query.jsx
Created March 11, 2018 00:21 — forked from rippedspine/searchkit-update-query.jsx
first solution to update searchkit elastic query on prop change
import React from 'react'
import _set from 'lodash/set'
import _get from 'lodash/get'
const searchkit = new SearchkitManager(`/elastic/materials`, {
withCredentials: true
})
class SearchApp extends SearchkitComponent {
@banhaclong20
banhaclong20 / searchkit-load-more.jsx
Created March 11, 2018 00:21 — forked from rippedspine/searchkit-load-more.jsx
Proof of concept, load more component with searchkit accessors
import React from 'react'
import _debounce from 'lodash/debounce'
import _get from 'lodash/get'
import {
SearchkitComponent,
PageSizeAccessor
} from 'searchkit'
import React, { Component } from 'react';
import extend from 'lodash/extend';
import { SearchkitManager,SearchkitProvider,
SearchBox, Pagination, HitsStats, NoHits, ViewSwitcherHits,
Layout, TopBar, LayoutBody, LayoutResults,
ActionBar, ActionBarRow, QueryAccessor} from 'searchkit';
import './index.css';
import {
SearchkitAutosuggest, HierarchicalRefinementDatasource,
import React, { Component } from "react";
import { render } from "react-dom";
import "./index.css";
class Widget extends Component {
state = { text: "" };
handleChange = (e) => {
this.setState({ text: e.target.value });
};
render() {
@banhaclong20
banhaclong20 / example01.js
Created March 17, 2018 21:35 — forked from mpj/example01.js
Code for the async/await episode of Fun Fun Function.
const response = await fetch(`https://catappapi.herokuapp.com/users/${userId}`)
const data = await response.json()
return data.imageUrl
}
@banhaclong20
banhaclong20 / basic.md
Created April 15, 2018 18:13 — forked from zenorocha/basic.md
New Firebase Auth vs Old Firebase Auth