Skip to content

Instantly share code, notes, and snippets.

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

Ahmed El Gabri ahmedelgabri

🤔
...
View GitHub Profile
@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)]
@ahmedelgabri
ahmedelgabri / gist:7673970
Last active December 29, 2015 12:59
How can I run a bash alias on a server from my local machine?

On my laptop

Inside ~/.ssh/config file I have this

Host <serverAlias>
    HostName 127.0.0.1 #Server IP
    User <username>
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
@ahmedelgabri
ahmedelgabri / gist:7721910
Last active December 29, 2015 20:09
Emmet.sublime-settings
{
"snippets": {
"css": {
"snippets": {
"inc": "@include $1($2);",
"ext": "@extend $1;",
"imp": "@import '$1';",
"mix": "@mixin ${1:mixin-name}${2:(${3:$params})} {\n\t$4\n}"
}
}

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 / 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();
}
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'],
{
"libs": [
"ecma5",
"ecma6",
"browser",
"jquery"
],
"loadEagerly": [],
"async": true,
"dontLoad":[
@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.
@ahmedelgabri
ahmedelgabri / # weechat - 2017-11-21_19-25-39.txt
Created November 21, 2017 18:27
weechat on macOS 10.13.1 - Homebrew build logs
Homebrew build logs for weechat on macOS 10.13.1
Build date: 2017-11-21 19:25:39
@ahmedelgabri
ahmedelgabri / # weechat - 2017-11-21_19-34-28.txt
Created November 21, 2017 18:35
weechat on macOS 10.13.1 - Homebrew build logs
Homebrew build logs for weechat on macOS 10.13.1
Build date: 2017-11-21 19:34:28