Skip to content

Instantly share code, notes, and snippets.

View alemohamad's full-sized avatar

Ale Mohamad ⌘ alemohamad

View GitHub Profile
@alemohamad
alemohamad / basic-authorization.php
Created December 24, 2014 14:56
Basic authorization with retries
<?php
$valid_passwords = array ("admin" => "12345");
$valid_users = array_keys($valid_passwords);
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
$validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SyntaxHighlighter</title>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPHP.js"></script>
<?php
function readable_pass() {
$vowels = 'aeiou';
$consonants = 'bcdfghjklmnpqrstvwxyz';
$result = null;
for($i = 0; $i < 10; $i++) {
if($i % 2)
  1. Go for women you perceive to be “out of your league.” You’ll surprise yourself.
  2. Never have sex with anyone that doesn’t want it as much as you.
  3. Never hit anyone unless they are an immediate threat.
  4. Every hat should serve a purpose.
  5. Never take her to the movies on the first date.
  6. Learn to wet shave.
  7. Nothing looks more badass than a well-tailored suit.
  8. Shave with the grain on the the first go-around.
  9. Always look a person in the eye when you talk to them.
  10. Buy a plunger before you need a plunger.

Install Laravel 5 through Composer

First install Composer, then:

$ composer create-project laravel/laravel <project-name>

After that we can start a webserver, and test the default index page:

Design

  • favicon.ico: 32x32 @ iConvert Icons
  • iOS icons: 57x57, 72x72, 76x76, 114x114, 120x120, 144x144, 152x152 (apple-touch-icon-precomposed.png)
  • Facebook images: 1024x1024, 16x16, 155x100, 800x150, 180x115, 394x150, 1200x630
  • Twitter images: 73x73, 1200x630
  • Email designs has to have 600px wide

SEO

  • h1, h2, h3
  • title (max: 60 chars)
@alemohamad
alemohamad / numeric-convert.js
Created January 9, 2014 15:33
Convert integer to binary or hexadecimal, and the other way.
function dec2bin(number) {
return number.toString(2);
}
function bin2dec(number) {
return parseInt(number, 2);
}
function dec2hex(number) {
return number.toString(16);
@alemohamad
alemohamad / available.php
Created December 14, 2013 20:42
Check if a website is available
<?php
ini_set("default_socket_timeout", "05");
set_time_limit(5);
$f = fopen("http://github.com", "r");
$r = fread($f, 1000);
fclose($f);
if (strlen($r) > 1) {
@alemohamad
alemohamad / metatags.php
Created December 14, 2013 20:41
Discover and Display Meta Tags
<?php
$tags = get_meta_tags('http://clarin.com/');
echo $tags["language"]; // es
echo $tags["distribution"] // Global
echo $tags["robots"] // all
echo $tags["author"] // Clarin.com
echo $tags["classification"] // noticias, información, videos, diario, newspaper
echo $tags["description"] // Clarin.com. Noticias de la Argentina y el mundo. Información actualizada las 24 horas y en español.