Skip to content

Instantly share code, notes, and snippets.

View adeyahya's full-sized avatar
😶
I can't fix broken printing machine!

Ade Yahya Prasetyo adeyahya

😶
I can't fix broken printing machine!
View GitHub Profile
@adeyahya
adeyahya / Default (OSX).sublime-keymap
Created September 22, 2016 04:44
Sublime Text keymap to invoke emmet inside jsx
[
{
"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": [
@adeyahya
adeyahya / reg_replace.sublime-setting
Created September 22, 2016 04:47
Replace class with className when using jsx syntax in sublime text
{
"replacements": {
"js_class": {
"find": " class=\"",
"replace": " className=\"",
"greedy": true,
"case": false
}
}
}
@adeyahya
adeyahya / tmux-cheatsheet.markdown
Created November 14, 2016 05:14 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@adeyahya
adeyahya / README.md
Created January 19, 2017 03:47 — forked from jonathantneal/README.md
Local SSL websites on macOS Sierra

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"
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)
})
}
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)
})
@adeyahya
adeyahya / README.md
Created October 19, 2017 08:05
Change all commit author name or Email

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
(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 / csvutils.js
Created January 14, 2018 20:24
CSV Utils using Ramda
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] !== '');
@adeyahya
adeyahya / viscosity-to-ovpn.py
Created December 9, 2019 19:13 — forked from ishahid/viscosity-to-ovpn.py
Convert all of your Viscosity connections into OVPN configuration files for OpenVPN
#!/usr/bin/python
"""Convert all of your Viscosity connections into OVPN configuration files for OpenVPN
https://gist.github.com/ishahid/693c2c97b3236a3c2416fc09ab170244
"""
import re
import glob
from os.path import expanduser, dirname