Skip to content

Instantly share code, notes, and snippets.

Ian Fabs ianfabs

Block or report user

Report or block ianfabs

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
View README.md
```hljs-meta
~/workspace
```$ export PATH
@ianfabs
ianfabs / list.md
Created Sep 3, 2019
A List of really cool web-based tools
View list.md
@ianfabs
ianfabs / index.js
Created May 21, 2019
Zero-width char exploit
View index.js
const toZW = (text) => {
const zeroPad = num => '00000000'.slice(String(num).length) + num;
const textToBinary = username => (
username.split('').map(char => zeroPad(char.charCodeAt(0).toString(2))).join(' ')
);
const binaryToZeroWidth = binary => (
binary.split('').map((binaryNum) => {
const num = parseInt(binaryNum, 10);
View .nvimrc
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/home/ianfabs/.config/nvim/bundle/repos/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('/home/ianfabs/.config/nvim/bundle/repos')
call dein#begin('/home/ianfabs/.config/nvim/bundle/repos')
View gist:d2663f80da08da55ad497fb7f280006b
#: Color scheme {{{
foreground #ebdbb2
background #282828
#: black
color0 #282828
color8 #928374
#: red
View setup.sh
#!/bin/bash
RED='\033[0;31m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
#Update and install necesary tools
echo "${BLUE}UPDATING AND INSTALLING TOOLS ${NC}\n"
sudo apt update
@ianfabs
ianfabs / one-liners.js
Created Mar 5, 2019
A collection of lovely one-liners that I use
View one-liners.js
// A sleep implementation in javascript
const sleep = t => new Promise(r=>setTimeout(r,t));
// A function that rearranges an object returned by mongoose to play nicely with graphql resolvers
const objectify = o => (o.isArray()?o.map(e=>objectify(e)):({...o.toObject(),_id:o._id.toString()}));
@ianfabs
ianfabs / sleep.js
Created Mar 2, 2019
A tiny module that implements sleep in javascript
View sleep.js
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
module.exports = sleep;
@ianfabs
ianfabs / objectify.js
Created Mar 2, 2019
This function solves an issue i was experiencing on a project where mongoose wasn't correctly returning an object for graphql resolvers. This fixes that issue by returning a new version of the object supplied to the function and converting the object id to a string.
View objectify.js
//long version
const objectify = object => (
object.isArray()
?
object.map(element => objectify(element))
:
({
...object.toObject(),
_id: object._id.toString(),
})
@ianfabs
ianfabs / db.js
Last active Apr 9, 2019
A really really REAAAALLLY tiny DB I made for testing things, works great with graphql apis :-)
View db.js
// Do not use this class yet, please just use the Collection class
class DB {
constructor(collections) {
if (
collections !== null &&
collections !== undefined &&
collections !== []
) {
//this._db = collections.map((s, i) => ({ ...s, id: i }));
if (collections instanceof Object) {
You can’t perform that action at this time.