Skip to content

Instantly share code, notes, and snippets.

View khalidchawtany's full-sized avatar

Khalid H. Ahmed khalidchawtany

View GitHub Profile
@khalidchawtany
khalidchawtany / pass-slots.md
Created June 13, 2020 10:40 — forked from loilo/pass-slots.md
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@khalidchawtany
khalidchawtany / callPrint.js
Created July 14, 2019 18:21 — forked from mcfearsome/callPrint.js
Electron launch and print a hidden webview
import { ipcRenderer } from 'electron'
ipcRenderer.send('print', { device: 'printer name', width: 210 })

SPC

SPC (Jump to word)

TAB (Previous buffer visible in window)

! (Run shell command)

’ (Pop up shell)

* / (Search in project)

0,1,…,9 (Jump to window)

: (Run M-x)

; (Comment operator)

? (Helm session with keybindings)

Large Object Motions:
(
)
{
}
[[
[]
][
]]
[m
@khalidchawtany
khalidchawtany / .phoenix.js
Created September 30, 2015 04:32
Pheonix config with modal keys
// This is my configuration for Phoenix <https://github.com/sdegutis/Phoenix>,
// a super-lightweight OS X window manager that can be configured and
// scripted through Javascript.
var mNone = [],
mCmd = ['cmd'],
mShift = ['shift'],
nudgePixels = 10,
padding = 0,
previousSizes = {};
@khalidchawtany
khalidchawtany / tmux.md
Last active August 29, 2015 14:26 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@khalidchawtany
khalidchawtany / b.rb
Last active August 29, 2015 14:22 — forked from junegunn/b.rb
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf-tmux -u 30% --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |
#!/usr/bin/env bash
#
# Managing notes with fzf (https://github.com/junegunn/fzf)
# - CTRL-L: List txt files in descending order by their modified time
# - CTRL-F: Search file contents
NOTE_DIR="${NOTE_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
TRASH_DIR="$NOTE_DIR/trash"
cd "$NOTE_DIR"

Colors in terminal

It's a common confusion about terminal colors... Actually we have this:

  • plain ascii
  • ansi escape codes (16 color codes with bold/italic and background)
  • 256 color palette (216 colors+16gray + ansi) (colors are 24bit)
  • 24bit true color (888 colors (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@khalidchawtany
khalidchawtany / pr.md
Last active August 29, 2015 14:16 — forked from piscisaureus/pr.md

Checkout a PullRequest

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git