Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Ayman Farhat aymanfarhat

:octocat:
View GitHub Profile
@aymanfarhat
aymanfarhat / docker-compose.yml
Last active Dec 5, 2019
Example of docker-izing a wordpress setup in docker-compose
View docker-compose.yml
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
View frontend.sh
apt-get update
echo "[Install] Build essential"
sudo apt-get install build-essential
echo "[Install] Python software properties"
apt-get install python-software-properties
echo "[Install] git"
apt-get install git
View swift_mail.php
$to = array('ayman@test.com');
// setup Swift mailer parameters
$transport = Swift_SmtpTransport::newInstance( 'smtp.sendgrid.net', 465, 'ssl');
$transport->setUsername('aymanfarhat ');
$transport->setPassword('mypass');
$swift = Swift_Mailer::newInstance( $transport );
// create a message (subject)
View extract_from_file.py
def file_to_list(fname):
f = open(fname)
lst = f.readlines()
return [line.rstrip('\n') for line in lst]
def list_to_file(fname, lst):
f = open(fname, "w")
f.write("\n".join(lst))
@aymanfarhat
aymanfarhat / yalla.sh
Created May 21, 2014
Start a project and its common windows with tmux
View yalla.sh
#!/bin/sh
if [ -z "$1" ] ; then
echo "usage: $0 <projectname> [/path/to/project]"
exit 1
fi
MYPROJECT=$1
if [ -z "$2" ] ; then
@aymanfarhat
aymanfarhat / code_team_guidelines.txt
Last active Aug 29, 2015
A list of guidelines that every dev team should decide on for a project
View code_team_guidelines.txt
- Tab vs spaces
- Common Git workflow
- Code style to enforce
- variable naming conventions
- function naming convention
- Namespaces
- check PSR
- semantic versioning (http://semver.org/)
- JS linting with JSHint
- CSS pre-processor SASS vs LESS
@aymanfarhat
aymanfarhat / tweet_this.js
Created Mar 26, 2014
Simple Twitter intent generator
View tweet_this.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
@aymanfarhat
aymanfarhat / sendmail.py
Created Jan 1, 2014
Python snippet for sending email using unix sendmail
View sendmail.py
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from subprocess import Popen, PIPE
html = MIMEText("<html><head><title>Test Email</title></head><body>Some HTML</body>", "html")
msg = MIMEMultipart("alternative")
msg["From"] = "you@yourmail.com"
msg["To"] = "recipient@mail.com"
msg["Subject"] = "Python sendmail test"
View file.json
{
"title":"Tool Title",
"description": "Tool Description",
"version": "",
"author": {
"name":"",
"email":"",
"website":""
},
"repository_url": "",
View game.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating
// shim later with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
You can’t perform that action at this time.