Skip to content

Instantly share code, notes, and snippets.

View leongaban's full-sized avatar

Leon Gaban leongaban

View GitHub Profile
@leongaban
leongaban / keyArray.js
Created October 2, 2015 17:40
key in Array
function formatTagData(rawData) {
// console.log('rawData =',rawData);
// console.log('rawData.length =',rawData.length);
for (var key in rawData) {
// array_keys.push(key);
// array_values.push(a[key]);
var data_array = [];
for (var j=0; j<key.length; j++) {
@leongaban
leongaban / focusMeDirectives.js
Last active November 1, 2015 21:13
focusMe custom attribute Directive
/*global angular*/
////////////////////////////////////////////////////////////////////////////////
/**
* @name focusMe
* @namespace Directives
* @desc Select search input after clicking on search icon
*/
(function() {
angular.module('focusMeDirectives', [])
@leongaban
leongaban / custom-checkbox.html
Last active December 19, 2015 05:39 — forked from arbales/gist:592332
Custom checkbox
<!-- http://jsfiddle.net/hM3s8/2/ -->
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
@leongaban
leongaban / gup.js
Created March 3, 2016 20:16
Get variable from URL param
// For url with ?search=param
// http://stackoverflow.com/a/979997/168738
function gurlp( name, url ) {
if (!url) url = location.href;
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return results == null ? null : results[1];
@leongaban
leongaban / gulpfile.js
Last active April 12, 2016 05:38
gulpfile.js
////////////////////////////////////////////////////////////////////////////////
/**
* @name Gulp taskrunner
* @desc Gulp taskrunner for TickerTags.dashboard
*/
var gulp = require('gulp'),
gutil = require('gulp-util'),
gulpif = require('gulp-if'),
uglify = require('gulp-uglify'),
@leongaban
leongaban / RamdaUtility.js
Created September 1, 2016 15:54
Utility service using the Ramda functional programming library
function Utility() {
const addOne = n => n + 1;
const notEmpty = R.compose(R.not, R.isEmpty);
const notIdentical = R.compose(R.not, R.identical);
const changeKeyName = R.curry((from, to, object) => {
const content = object[from];
@leongaban
leongaban / RamdaGetKeyName.js
Created September 7, 2016 16:30
Get name of key that is true
let tabs = {
twitter: true,
news: false,
blogs: false,
finNews: false
}
const isTrue = R.equals(true);
const getActive = R.filter(isTrue);
@leongaban
leongaban / keybase.md
Created January 5, 2017 04:19
keybase.md

Keybase proof

I hereby claim:

  • I am leongaban on github.
  • I am leongaban (https://keybase.io/leongaban) on keybase.
  • I have a public key whose fingerprint is 05E9 D608 6F35 27F6 915E 4239 E86D 3F61 A93E 100F

To claim this, I am signing this object:

@leongaban
leongaban / InfiniteScrolling.js
Created January 6, 2017 17:16
InfiniteScrolling
const maxlimitCheck = () => this.tags.length >= TOTAL_TAGS;
const checkScrollLimit = () => {
if (!LIMIT_REACHED) {
const scrollingTrue = true;
PARAMS.start += this.limit;
maxlimitCheck() ? LIMIT_REACHED = true : fetchTags(scrollingTrue);
}
};
@leongaban
leongaban / hyper.js
Created March 3, 2017 16:12
My HyperTerm gist
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',