Skip to content

Instantly share code, notes, and snippets.

View antronic's full-sized avatar
✌️
Working from home

Jirachai Chansivanon antronic

✌️
Working from home
View GitHub Profile
@antronic
antronic / pokedex-jquery-1.js
Created August 19, 2016 10:49 — forked from chaintng/pokedex-jquery-1.js
pokedex-jquery-1
// 1. set Listener for each filter
$("#pokemonTypeFilter").on('change', function(){
var filterPokemonType = this.value;
var filterPokemonAtk = $("#pokemonAtkFilter").val();
var filterPokemon = filterPokemonByTypeAndMinAtk(allPokemons, filterPokemonType, filterPokemonAtk);
renderPokemonList(filterPokemon);
});
$("#pokemonAtkFilter").on('keyup', function(){
var filterPokemonAtk = this.value;
@antronic
antronic / pokedex-jquery-2.js
Created August 19, 2016 10:50 — forked from chaintng/pokedex-jquery-2.js
pokedex-jquery-2.js
// 2. set render function
var renderPokemonList = function(filterPokemon) {
$("#filterPokemonCount").html(filterPokemon.length);
var liStrings = filterPokemon.map(function (item) {
return "<li>" + item.name + " (Atk: " + item.attack + ", Def: " + item.defense + ")</li>";
});
$("#pokemonListUl").html(liStrings);
}
@antronic
antronic / pokedex-react-1.js
Created August 19, 2016 10:54 — forked from chaintng/pokedex-react-1.js
pokedex-react-1.js
// 1. set Reducer function to accept store.dispatch()
var reducer = function (state, action) {
var newState = state;
if (typeof state === 'undefined') {
return {
pokemonType: null,
pokemonAtk: null
};
}
switch (action.type) {
@antronic
antronic / pokedex-react-2.js
Created August 19, 2016 10:54 — forked from chaintng/pokedex-react-2.js
pokedex-react-2.js
// 3. set render function
var render = function() {
var filterPokemonType = store.getState().pokemonType;
var filterPokemonAtk = store.getState().pokemonAtk;
var filterPokemon = filterPokemonByTypeAndMinAtk(allPokemons, filterPokemonType, filterPokemonAtk);
ReactDOM.render(
<div>
<div>--- Total Filter Pokemon: {filterPokemon.length} ---</div>
<ul>
@antronic
antronic / pokemonComponent.js
Created August 19, 2016 10:54 — forked from chaintng/pokemonComponent.js
pokemonComponent.js
return <PokemonInfo pokemonDetail={item} />
{
"info": {},
"data": [
{
"receipt_id": "R012760012",
"type": "in_debt",
"timestamp": "1485470001375",
"cost": 10400
}
]
@antronic
antronic / getbathtext.js
Created March 5, 2017 10:21 — forked from nantcom/getbathtext.js
Get Thai Baht Text using JavaScript
var getBathText = function (inputNumber) {
var getText = function (input) {
var toNumber = input.toString();
var numbers = toNumber.split('').reverse();
var numberText = "/หนึ่ง/สอง/สาม/สี่/ห้า/หก/เจ็ด/แปด/เก้า/สิบ".split('/');
var unitText = "/สิบ/ร้อย/พ้น/หมื่น/แสน/ล้าน".split('/');
var output = "";
import {connect} from 'react-redux'
import { toggleMenu } from '../../actions/uiState'
import React, { Component } from 'react'
import 'hamburgers/dist/hamburgers.min.css'
import './style.scss'
@antronic
antronic / cloudSettings
Last active July 24, 2020 15:00
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-07-24T15:00:50.854Z","extensionVersion":"v3.4.3"}