Skip to content

Instantly share code, notes, and snippets.

View alemohamad's full-sized avatar

Ale Mohamad ⌘ alemohamad

View GitHub Profile
@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);

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)

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:

  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.
<?php
function readable_pass() {
$vowels = 'aeiou';
$consonants = 'bcdfghjklmnpqrstvwxyz';
$result = null;
for($i = 0; $i < 10; $i++) {
if($i % 2)
<!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>
@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]);

Basic Vi Commands

Modes & Controls

Command Description
vi filename Edit filename
vi -r filename Edit last version of filename after crash
vi + n filename Edit filename at end of file
vi + filename Edit filename at end of file