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;
@mokagio
mokagio / sticky.css
Created February 26, 2012 20:53
Twitter Bootstrap + Sticky Footer + Fixed Nav Bar
html, body, .container, .content {
height: 100%;
}
.container, .content {
position: relative;
}
.proper-content {
padding-top: 40px; /* >= navbar height */
@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 <[email protected]>
#REQUIRED PARAMS
username="[email protected]"
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 / DialANumber.java
Created June 2, 2012 14:21
Android: Dial A Number
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;