Skip to content

Instantly share code, notes, and snippets.

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

Ahmed El Gabri ahmedelgabri

🤔
...
View GitHub Profile
@ahmedelgabri
ahmedelgabri / cicada.css
Created June 9, 2011 18:24 — forked from Zoramite/cicada.css
Cicada + CSS Backgrounds
.example1 {
background-color: #efefef;
background-image: -webkit-linear-gradient(0, rgba(222,213,108,.07) 50%, transparent 50%), -webkit-linear-gradient(0, rgba(201,184,88,.13) 50%, transparent 50%), -webkit-linear-gradient(0, transparent 50%, rgba(168,137,73,.17) 50%), -webkit-linear-gradient(0, transparent 50%, rgba(99,78,60,.19) 50%);
background-image: -moz-linear-gradient(0, rgba(222,213,108,.07) 50%, transparent 50%), -moz-linear-gradient(0, transparent 50%, rgba(201,184,88,.13) 50%), -moz-linear-gradient(0, rgba(168,137,73,.17) 50%, transparent 50%), -moz-linear-gradient(0, transparent 50%, rgba(99,78,60,.19) 50%);
background-image: -o-linear-gradient(0, rgba(222,213,108,.07) 50%, transparent 50%), -o-linear-gradient(0, transparent 50%, rgba(201,184,88,.13) 50%), -o-linear-gradient(0, transparent 50%, rgba(168,137,73,.17) 50%), -o-linear-gradient(0, rgba(99,78,60,.19) 50%, transparent 50%);
background-image: linear-gradient(0, rgba(222,213,108,.07) 50%, transparent 50%), linear-gradient(0, rgba(201
function getDominantColor(aImg) {
let canvas = document.createElement("canvas");
canvas.height = aImg.height;
canvas.width = aImg.width;
let context = canvas.getContext("2d");
context.drawImage(aImg, 0, 0);
// keep track of how many times a color appears in the image
let colorCount = {};
@ahmedelgabri
ahmedelgabri / search dash app
Created August 3, 2013 14:33
Shell function to search dash app http://kapeli.com/dash from the terminal
# usage: dash <keyword>:<query> or dash <query>
dash(){
open "dash://$@"
}
@ahmedelgabri
ahmedelgabri / Sublime Text command log
Created September 21, 2013 19:19
Log Sublime Text command in the console, very helpful when trying to figure out command you want to create shortcuts for.
sublime.log_commands(True)
@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}"
}
}
@ahmedelgabri
ahmedelgabri / gist:8122545
Last active December 22, 2020 08:46
Shell function to open a static server (Python, Ruby or PHP)

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

Read first

I have a local file called ~/.zstuff that I load all ENV variables that is not supposed to be public like $GITHUB_TOKEN in it & I source this file inside my main .zshrc file. The $GITHUB_USER can be added to the same file or your normal .zshrc file since it not a senstive information.

The .zstuff Shoudn't be public or part of your .dotfiles repo.

@ahmedelgabri
ahmedelgabri / mq.styl
Created December 1, 2014 12:26
Media queries in Stylus
MQ = true
mq(point, query1=min, query2=width)
if MQ
query = 'screen and (%s-%s: %sem)' % (query1 query2 point/16)
@media query
{block}
else
{block}
@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')