Skip to content

Instantly share code, notes, and snippets.

View hanigamal's full-sized avatar
🎯
Focusing at office

Hani Gamal hanigamal

🎯
Focusing at office
View GitHub Profile
@hanigamal
hanigamal / fine-intersect.cpp
Created September 13, 2013 21:47
Find the point of intersection of two 3D line segments, works in 2D if z=0
// Assume Coord has members x(), y() and z() and supports arithmetic operations
// that is Coord u + Coord v = u.x() + v.x(), u.y() + v.y(), u.z() + v.z()
inline Point
dot(const Coord& u, const Coord& v)
{
return u.x() * v.x() + u.y() * v.y() + u.z() * v.z();
}
inline Point
@hanigamal
hanigamal / NanoHTTPD.java
Created June 2, 2012 13:23
A simple, tiny, nicely embeddable HTTP 1.0 (partially 1.1) server in Java
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
@hanigamal
hanigamal / nanoHTTPD
Created May 4, 2012 05:17
A simple, tiny, nicely embeddable HTTP 1.0 (partially 1.1) server in Java
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
@hanigamal
hanigamal / wp-query-ref.php
Created August 14, 2013 02:13
WordPress Query Comprehensive Reference
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(
@hanigamal
hanigamal / snaptoroad.js
Last active February 25, 2019 14:54 — forked from omkz/snaptoroad.js
google maps API javascript v3 - polyline snap to road
var directionsService = new google.maps.DirectionsService();
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
var polyline = new google.maps.Polyline(polylineOptions);
var path = response.routes[0].overview_path;
for (var x in path) {
@hanigamal
hanigamal / wp-install.sh
Created August 14, 2013 02:15
WordPress Commandline Local Install
#!/bin/bash
#
# WP Commandline Local Install, by Brian Richards (@rzen)
#
# Creates a new directory, downloads WordPress, creates a database, sets up wp-config,
# optionally empties wp-content, and deletes other misc files. This compliments my local
# dev setup, outlined here: http://rzen.net/development/local-develoment-in-osx/
#
# Credit:
# Based on WPBuildr (https://github.com/AaronHolbrook/wpbuildr/). Props to Aaron Holbrook
@hanigamal
hanigamal / CodeReviewChecklist.md
Created October 19, 2018 15:11 — forked from cartermp/CodeReviewChecklist.md
CASS Code Review Checklist

General Non-Code

  • Does the application compile?
  • Does the application, with changes, run without crashing?
  • Can a database, if applicable, be deployed without error?
  • If a new feature is under review, does the new feature act as expected (if this is easy to test)?
  • Does the commit message indicate the scope of the change set?
  • Does the commit message call out any future work that remains to be done?
  • Does the scope of the change set appear to fulfill the given task, and only that task?
  • Is the change set associated with its appropriate work item?
- General
[ ] The code works
[ ] The code is easy to understand
[ ] Follows coding conventions
[ ] Names are simple and if possible short
[ ] Names are spelt correctly
[ ] Names contain units where applicable
[ ] Enums are used instead of int constants where applicable
[ ] There are no usages of 'magic numbers'
[ ] All variables are in the smallest scope possible
@hanigamal
hanigamal / Stats-animation..markdown
Created January 24, 2015 10:26
Stats animation.

Stats animation.

I loved Virgil's Dribble shot and decided to remake it with some SVG animations :) I didn't really want to recreate the curvy line since I believe straight lines are more accurate. Sorry Virgil, I might make them curvy one day :)! With a bit of time on my hands I could make it even more detailed. I hope you like it and post some feedback on how to make this better :)! Don't forget to check out the original at http://goo.gl/0aKiS0

Kudos Virgil!

Forked from Jonas Badalic's Pen Stats animation..

@hanigamal
hanigamal / README.md
Created August 11, 2017 23:57 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/