Skip to content

Instantly share code, notes, and snippets.

View hoanganh25991's full-sized avatar

Anh Le hoanganh25991

  • https://originallyus.sg
  • Vietnam
View GitHub Profile
@hoanganh25991
hoanganh25991 / refactor-me-s1.js
Last active August 19, 2016 14:07
options [a,b,c,..], if has a > use a, if not check b, use b, if not check c, use c...
//refactor code
var findWhere = ['a.ewEdit', 'a.ewView'];
var isBinded = false;
var findIndex = 0;
while(!isBinded && findIndex < findWhere.length){
findIndex++;
@hoanganh25991
hoanganh25991 / Log.java
Created May 16, 2016 07:06 — forked from solominh/Log.java
Android Log Class
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hoanganh25991
hoanganh25991 / abc.md
Created March 23, 2016 10:57
plantuml in markdown

class

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hoanganh25991
hoanganh25991 / district-boundary-hcm-city.geojson
Created March 19, 2016 17:55
geojson file, disctricy boundary
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hoanganh25991
hoanganh25991 / svg-example.js
Last active March 19, 2016 15:58
Google Maps API, often used functions
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(-33.92, 151.25),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var template = [
'<?xml version="1.0"?>',
'<svg width="26px" height="26px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg">',
'<circle stroke="#222" fill="{{ color }}" cx="50" cy="50" r="35"/>',
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hoanganh25991
hoanganh25991 / index.php
Created February 26, 2016 03:12
save scroll state
<!DOCTYPE html>
<html>
<head>
<title>save scroll state</title>
<style type="text/css" media="screen">
.single-post{
padding: 20px;
margin: 20px 0;
width: 300px;
height: 400px;
@hoanganh25991
hoanganh25991 / prototype.js
Created January 14, 2016 02:59
prototype chain in javascript
var storage = {"name":"hoang-anh", "rong":"10m", "dai":"20m"};
if(typeof Object.create != 'function'){
Object.create = function(object){
var f = function(){};
f.prototype = object;
return new f();
};
}
var storage_1 = Object.create(storage);
@hoanganh25991
hoanganh25991 / print-object.js
Created January 14, 2016 02:58
print object from javascript to html
function print_r(theObj, div){
div = typeof div == 'undefined'? $('body') : div;
if(theObj.constructor == Array || theObj.constructor == Object){
div.append("<ul>")
for(var p in theObj){
if(theObj[p].constructor == Array || theObj[p].constructor == Object){
div.append("<li>["+p+"] => "+typeof(theObj)+"</li>");
div.append("<ul>")
print_r(theObj[p]);
div.append("</ul>")