Skip to content

Instantly share code, notes, and snippets.

View leongaban's full-sized avatar

Leon Gaban leongaban

View GitHub Profile
@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 / 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 / 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 / capitalizeFirstLetter.js
Last active February 21, 2019 19:07
capitalizeFirstLetter
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
// ES6 & Typescript version:
export const capitalizeFirstLetter = (word: string) =>
word.charAt(0).toUpperCase() + word.slice(1);
@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 / 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 / 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 / formatData.js
Created October 2, 2015 16:36
formatData
// If tags, GET tag volume data:
if (tags.length > 0) {
console.log('tags.length: ',tags.length);
for (var i=0; i<tags.length; i++) {
var loopStep = i;
rawTagData = [];
GetTweetVolFactory.returnTweetVol(tags[i].term_id, limit_range)
@leongaban
leongaban / HighChartsDirective.js
Last active August 29, 2015 14:26
HighChartsDirective.js
/*global angular*/
////////////////////////////////////////////////////////////////////////////////
/**
* @name highChart
* @namespace Directive
* @desc Displays our custom HighCharts chart
*/
(function() { "use strict";
@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'),