Skip to content

Instantly share code, notes, and snippets.

😳
?

Ade Yahya Prasetyo adeyahya

😳
?
Block or report user

Report or block adeyahya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adeyahya
adeyahya / csvutils.js
Created Jan 14, 2018
CSV Utils using Ramda
View csvutils.js
const R = require('ramda');
const csvToArray = csvText =>
csvText
.split('\n')
.map(item => item.split(','))
// new line will produce Array with length 1 & with value ''
// ignore it
.filter(item => item[0] !== '');
View scrollDirection.js
(function() {
let lastScrollTop = 0;
let scrollUpEvent = new Event("scrollUp");
let scrollDownEvent = new Event("scrollDown");
document.addEventListener("scroll", function(){ // or window.addEventListener("scroll"....
let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
if (scrollTop > lastScrollTop){
document.dispatchEvent(scrollDownEvent);
} else {
@adeyahya
adeyahya / README.md
Created Oct 19, 2017
Change all commit author name or Email
View README.md

Change all commit author name or Email

#!/bin/sh

git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
View currying.js
const curry = require('lodash/curry')
const match = curry(function(what, str) {
return str.match(what)
})
const replace = curry(function(what, replacement, str) {
return str.replace(what, replacement)
})
View dynamic-import.js
if ( 'IntersectionObserver' in window ) {
const observer = new IntersectionObserver(callback, options)
observer.observe($el)
} else {
import(/* webpackChunkName: "intersection-observer" */ 'intersection-observer').then(_ => {
const observer = new IntersectionObserver(callback, options)
observer.observe($el)
})
}
@adeyahya
adeyahya / README.md
Created Jan 19, 2017 — forked from jonathantneal/README.md
Local SSL websites on macOS Sierra
View README.md

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@adeyahya
adeyahya / reg_replace.sublime-setting
Created Sep 22, 2016
Replace class with className when using jsx syntax in sublime text
View reg_replace.sublime-setting
{
"replacements": {
"js_class": {
"find": " class=\"",
"replace": " className=\"",
"greedy": true,
"case": false
}
}
}
@adeyahya
adeyahya / Default (OSX).sublime-keymap
Created Sep 22, 2016
Sublime Text keymap to invoke emmet inside jsx
View Default (OSX).sublime-keymap
[
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
You can’t perform that action at this time.