Skip to content

Instantly share code, notes, and snippets.

View ahmedelgabri's full-sized avatar
🤔
...

Ahmed El Gabri ahmedelgabri

🤔
...
View GitHub Profile
if findfile('.flowconfig', '.;') !=# ''
if executable($PWD .'/node_modules/.bin/flow')
let g:flow_path = $PWD .'/node_modules/.bin/flow'
else
let g:flow_path = 'flow'
endif
let g:neomake_javascript_flow_maker = {
\ 'exe': 'sh',
\ 'args': ['-c', g:flow_path.' --json --strip-root | flow-vim-quickfix'],
@ahmedelgabri
ahmedelgabri / getType.js
Created January 8, 2016 12:50
Simple check for the type of an object
function getType(target){
return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
}
@ahmedelgabri
ahmedelgabri / helpers.js
Last active December 28, 2015 18:12
JS helper functions
// $('div') or $('.class', $('div'))
const $ = (selector, parent) => (parent || document).querySelector(selector)
// $$('div') or $$('.class', $('div')) => returns a real Array not a NodeList
const $$ = (selector, parent) => [...(parent || document).querySelectorAll(selector)]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React for Beginners</title>
</head>
<body>
<div id="App"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react.min.js"></script>
@ahmedelgabri
ahmedelgabri / bbd
Last active September 16, 2015 06:22
A script to list branches by date http://davidwalsh.name/git-branches-date
#!/bin/sh
#
# Usage: bbd "Sep 14"
# bbd "Sep"
git reflog --date=local | grep "$1 .* checkout: moving from .* to" | grep -o "[a-zA-Z0-9\-]*$" | sort | uniq
@ahmedelgabri
ahmedelgabri / SassMeister-input-HTML.html
Created March 10, 2015 18:47
Generated by SassMeister.com.
<p>Lorem <a href="#">ipsum dolor</a> sit amet</p>
# From http://sass-guidelin.es/
# For SCSS-Lint v0.31.0
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
@ahmedelgabri
ahmedelgabri / _README.md
Last active February 17, 2017 07:49
Node script to export all your delicious bookmarks
  1. Download or clone the gist.
  2. cd into the directory & do $ npm install
  3. I have used nodedelicious and it needs you to store delcious username & password as enviromnet varaibles so you will need to do the following.
$ export DELICIOUS_USER="<your username>" && export DELICIOUS_PASSWORD="<your password>"
  1. Run $ node index.js
  2. PROFIT! you have your delicious export in a file called bookmarks.html that you can save or import in Pocket.

Keybase proof

I hereby claim:

  • I am ahmedelgabri on github.
  • I am ahmedelgabri (https://keybase.io/ahmedelgabri) on keybase.
  • I have a public key ASBn5CQMC-lRe3exGPiMon9fXrgYYbBm3ycEoHccpL1alQo

To claim this, I am signing this object:

@ahmedelgabri
ahmedelgabri / index.jade
Created December 1, 2014 12:30
Add Custom Jade tags
doctype html
html
head
title Hi
body
div
span= formatDate('Dec 25, 1995')