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 / cicada.css
Created Jun 9, 2011 — forked from Zoramite/cicada.css
Cicada + CSS Backgrounds
View cicada.css
.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
View dominant-color.js
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 Aug 3, 2013
Shell function to search dash app http://kapeli.com/dash from the terminal
View search dash app
# usage: dash <keyword>:<query> or dash <query>
dash(){
open "dash://$@"
}
@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:7673970
Last active Dec 29, 2015
How can I run a bash alias on a server from my local machine?
View gist:7673970

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 Dec 29, 2015
Emmet.sublime-settings
View gist:7721910
{
"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 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 Readme.md

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 Dec 1, 2014
Media queries in Stylus
View mq.styl
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 Dec 1, 2014
Add Custom Jade tags
View index.jade
doctype html
html
head
title Hi
body
div
span= formatDate('Dec 25, 1995')
You can’t perform that action at this time.