Skip to content

Instantly share code, notes, and snippets.

View unbug's full-sized avatar
🐝
Keep calm.

Unbug Lee unbug

🐝
Keep calm.
View GitHub Profile
![image](https://user-images.githubusercontent.com/799578/61851405-767c9580-aee9-11e9-9ebb-19ce90e6acc2.png)
{
"name": "Algo",
"id": "ed564832",
"parentId": "",
"children": [
{
"name": "Data Structures",
"id": "7c5581e1",
"parentId": "ed564832",
"children": [
@unbug
unbug / disable_autospell.md
Last active July 12, 2024 21:06 — forked from urbanautomaton/disable_autospell.md
disable autospell completely
sudo mv /System/Library/Services/AppleSpell.service{,.disabled}

Nvm. For anyone else having this problem you need to reboot your mac and press ⌘+R when booting up. Then go into Utilities > Terminal and type the following commands:

csrutil disable
reboot 
@unbug
unbug / Middleware.js
Last active January 6, 2024 04:17
Powerful Javascript Middleware Pattern Implementation, apply middleweares to any object. https://unbug.github.io/js-middleware/
'use strict';
/* eslint-disable consistent-this */
let middlewareManagerHash = [];
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
function identity(x){
return x;
}
function add(a, b){
return a+b;
}
function mul(a, b){
return a*b;
function bubbleSort(arr){
if(arguments.lenght === 0 || !Array.isArray(arr)){
throw new Error();
}
var hasHadChange;
for(var i=0;i<arr.length-1;i++){
hasHadChange = false;
for(var x=0;x<arr.length-1;x++){
if(arr[x]>arr[x+1]){
hasHadChange = true;
function quicksort(arr){
//base case
if(arr.length<=1){ return arr;}
//now find swap position and value
var swapPos = Math.floor((arr.length-1)/2),
swapVal = arr[swapPos],
less = [], more = [];
arr = arr.slice(0, swapPos).concat(arr.slice(swapPos+1));
for(var i=0;i<arr.length;i++){
@unbug
unbug / BST
Last active May 19, 2016 09:14
//https://www.cs.usfca.edu/~galles/visualization/BST.html
function Node(data, left, right){
this.data = data;
this.left = left;
this.right = right;
this.show = show;
}
function show(){
return this.data;
}
@unbug
unbug / Sync gh-pages + master branches
Created March 24, 2016 11:12 — forked from mandiwise/Sync gh-pages + master branches
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@unbug
unbug / gist:e007ac69189d43a65d0f
Created December 28, 2015 06:46
cool loading....
https://365webresources.com/10-best-pure-css-loading-spinners-front-end-developers/