Skip to content

Instantly share code, notes, and snippets.

🤔
...

Ahmed El Gabri ahmedelgabri

🤔
...
Block or report user

Report or block ahmedelgabri

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
@ahmedelgabri
ahmedelgabri / ts.md
Created Jul 2, 2019
global types in Typescript
View ts.md

I'm migrating a legacy codebase to Typescript & it has some global objects attached to window & I want these to be available always.

So I created globals.d.ts file that looks something like this

interface Foo {
  a: string;
  b: number;
}
@ahmedelgabri
ahmedelgabri / statusline.vim
Last active Jun 26, 2019
Trying to build my vim statusline without plugins
View statusline.vim
" Statusline & Tabline/Buffer line
" Dynamically getting the fg/bg colors from the current colorscheme, returns hex which is enough for me to use in Neovim
" Needs to figure out how to return cterm values too
let fgcolor=synIDattr(synIDtrans(hlID("Normal")), "fg", "gui")
let bgcolor=synIDattr(synIDtrans(hlID("Normal")), "bg", "gui")
" Tabline/Buffer line
set showtabline=2
set tabline="%1T"
View .tern-config
{
"ecmaVersion": 6,
"libs": [
"ecma5",
"ecma6",
"browser"
],
"loadEagerly": [],
"async": true,
"plugins": {
@ahmedelgabri
ahmedelgabri / Sublime Text command log
Created Sep 21, 2013
Log Sublime Text command in the console, very helpful when trying to figure out command you want to create shortcuts for.
View Sublime Text command log
sublime.log_commands(True)
@ahmedelgabri
ahmedelgabri / gist:8122545
Last active Oct 17, 2018
Shell function to open a static server (Python, Ruby or PHP)
View gist:8122545

Static server shell function

A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.

How it works

$ staticServer <lang> <port> #port is optional, default is 8000
View gist:38663fc4f7766eccc06c2a3b2a159c17
/usr/bin/sandbox-exec -f /private/tmp/homebrew20181003-80602-18w30bh.sb nice /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/ruby-macho-2.1.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/plist-3.4.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/backports-3.11.4/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/activesupport-5.2.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/tzinfo-1.2.5/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/thread_safe-0.3.6/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/minitest-5.11.3/lib:/usr/local/Homebrew/Library/Homebrew/
@ahmedelgabri
ahmedelgabri / # weechat - 2018-09-30_14-59-50.txt
Created Sep 30, 2018
weechat on macOS 10.14 - Homebrew build logs
View # weechat - 2018-09-30_14-59-50.txt
Homebrew build logs for weechat on macOS 10.14
Build date: 2018-09-30 14:59:50
View curry.js
fmap = (f => g => x => (f (g (x))))
curryOnce = (f => x => (...xs) => (f (x, ...xs)))
curry = (n => f => (
(n === 1) ?
(f) :
(fmap (curry (n - 1)) (curryOnce (f)))))
method = (m => (m.call.bind (m)))
methodWithArgs = (n => m => (curry (n) (method (m))))
flip = (f => x => y => (f (y) (x)))
split = (methodWithArgs (2) (''.split))
@ahmedelgabri
ahmedelgabri / # weechat - 2017-11-27_20-21-58.txt
Created Nov 27, 2017
weechat on macOS 10.13.1 - Homebrew build logs
View # weechat - 2017-11-27_20-21-58.txt
Homebrew build logs for weechat on macOS 10.13.1
Build date: 2017-11-27 20:21:58
@ahmedelgabri
ahmedelgabri / # weechat - 2017-11-21_19-34-28.txt
Created Nov 21, 2017
weechat on macOS 10.13.1 - Homebrew build logs
View # weechat - 2017-11-21_19-34-28.txt
Homebrew build logs for weechat on macOS 10.13.1
Build date: 2017-11-21 19:34:28
You can’t perform that action at this time.