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

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/usr/local/sublime-text-2/sublime_text
Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
// Generated on: 2012-04-13 23:44:46 GMT+00:00
// ************** Tweet 1 of 47455 **************
{
"in_reply_to_screen_name": null,
import android.accounts.Account;
import android.accounts.AccountManager;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Build;
import android.preference.PreferenceManager;
public final class AccountUtils {
@hanigamal
hanigamal / S3_regex.pl
Created June 11, 2012 17:03
Parse S3 log files using Perl regular expressions
#!/usr/bin/perl -w
use strict;
while (my $line=<>) {
my ($date, $host, $url_with_method, $status, $size, $referrer, $agent) = $line =~
m/^\S+\s+\S+\s+\[(\S+\s+[\-|\+]\d{4})\]\s+(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+"(\S+\s+\S+\s+[^"]+)"\s+(\d{3})\s+\S+\s+(\d+|-)\s+\d+\s+\d+\s+\d+\s+"(.*?)"\s+"(.*?)"/;
# Print relevant bits
}