Skip to content

Instantly share code, notes, and snippets.

View aymanfarhat's full-sized avatar
🏠
Working from home

Ayman Farhat aymanfarhat

🏠
Working from home
View GitHub Profile
@aymanfarhat
aymanfarhat / tweet_this.js
Created March 26, 2014 07:39
Simple Twitter intent generator
<!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 / code_team_guidelines.txt
Last active August 29, 2015 14:01
A list of guidelines that every dev team should decide on for a project
- 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 / yalla.sh
Created May 21, 2014 18:43
Start a project and its common windows with tmux
#!/bin/sh
if [ -z "$1" ] ; then
echo "usage: $0 <projectname> [/path/to/project]"
exit 1
fi
MYPROJECT=$1
if [ -z "$2" ] ; then
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))
$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)
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
@aymanfarhat
aymanfarhat / Euler 18.cs
Created September 9, 2012 16:49
Project Euler Problem 18
class Program
{
/* The triangle */
static int[][] triangle = null;
/* Saves respective optimal sums of nodes in the triangle */
static int[][] optimalSums = null;
static void Main(string[] args)
{
@aymanfarhat
aymanfarhat / String.format.js
Created January 6, 2013 14:31
Simple implementation of C#'s String.format() in Javascript for building strings
String.prototype.format = function()
{
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number)
{
return typeof args[number] != 'undefined'? args[number]:match;
});
};
@aymanfarhat
aymanfarhat / CodeJamQ_2009_A.py
Last active December 15, 2015 15:39
Google Code Jam 2009 - Qualification Round Problem A https://code.google.com/codejam/contest/90101/dashboard
# Parses each string patterns to list of strings and lists(options)
def parse_patterns(patterns):
lines = []
def getclosing(i,pattern):
for x in xrange(i,len(pattern)):
if pattern[x] == ")":
return x
return -1
@aymanfarhat
aymanfarhat / tomorrow-night-eighties.css
Created April 10, 2013 15:01
An edit of https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css for styling code tags that are not necessarily within a pre tag, useful for inline code highlighting.
/* Tomorrow Night Eighties Theme */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Edited by Ayman Farhat(http://aymanfarhat.com) for supporting inline code tags without pre */
.tomorrow-comment, code .comment, code .title {
color: #999999;
}
.tomorrow-red, code .variable, code .attribute, code .tag, code .regexp, code .ruby .constant, code .xml .tag .title, code .xml .pi, code .xml .doctype, code .html .doctype, code .css .id, code .css .class, code .css .pseudo {
color: #f2777a;