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 / dabblet.css
Created February 24, 2012 21:54
CSS Round Link Button
/**
* Round Link
*/
a.round:link, a.round:visited {
width: 140px;
color: #fff;
font: 28px/30px Arial;
text-transform: uppercase;
text-shadow: #6f0909 0 -1px 1px;
border: 1px solid #6F0909;
@hanigamal
hanigamal / internal-links.js
Created February 24, 2012 22:13
Smooth move to internal links
@hanigamal
hanigamal / dabblet.css
Created February 25, 2012 04:23
CSS3 Cool 3-states Buttons
/**
* CSS3 Cool 3-states Buttons
*/
ul { list-style: none; }
a.button {
display: block;
float: left;
position: relative;
height: 25px;
width: 80px;
@hanigamal
hanigamal / hextorgb.js
Created April 9, 2012 16:30
Convert a hex value to its decimal value
//Convert a hex value to its decimal value - the inputted hex must be in the
// format of a hex triplet - the kind we use for HTML colours. The function
// will return an array with three values.
function hex2num(hex) {
if(hex.charAt(0) == "#") hex = hex.slice(1); //Remove the '#' char - if there is one.
hex = hex.toUpperCase();
var hex_alphabets = "0123456789ABCDEF";
var value = new Array(3);
var k = 0;
var int1,int2;
@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 / twitter-status-bot.sh
Created June 1, 2012 19:10
Twitter status update bot
#!/bin/bash
#Twitter status update bot by http://360percents.com
#Author: Luka Pusic <pusic93@gmail.com>
#REQUIRED PARAMS
username="your@email.com"
password="yourpassw0rd"
tweet="$*" #must be less than 140 chars
#EXTRA OPTIONS
@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 / isNetAvailable.java
Created June 2, 2012 13:25
Network Availability
public boolean isNetworkAvailable() {
Context context = getApplicationContext();
ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity == null) {
boitealerte(this.getString(R.string.alert),"getSystemService rend null");
} else {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
@hanigamal
hanigamal / mp3oggHTTPserver.java
Created June 2, 2012 13:28
An smart MP3/OGG HTTP server that translates M3U playlist files
import java.io.*;
import java.util.*;
import java.net.*;
/**
* An smart MP3/OGG HTTP server that translates M3U playlist files
*
* <p> Mp3HTTPD version 1.04,
* Copyright &copy; 2001,2005 Jarno Elonen (elonen@iki.fi)
try {
URL u = new URL("http://hanigamal.net/resume.pdf");
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
String fileName = Environment.getExternalStorageDirectory().getAbsolutePath();
FileOutputStream f = new FileOutputStream(new File(fileName,"my.pdf"));