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
@patriciogonzalezvivo
patriciogonzalezvivo / PythonSetup.md
Created October 7, 2014 23:17
How to install Python correctly on Mac OSX

Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Add PATH to ~/.bash_profile and ~/.zshrc

export PATH=/usr/local/bin:$PATH
@idleberg
idleberg / Install-Mcrypt.md
Last active September 2, 2024 06:59
Install Mcrypt on macOS

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3
codestyle.co examples
@oliveratgithub
oliveratgithub / Batch File Rename.scpt
Last active January 5, 2025 03:03
Simple AppleScript to easily batch rename multiple files sequentially. GUI asks user to select files and input a name before renaming.
-- This code comes from https://gist.github.com/oliveratgithub/
-- Open in AppleScript Editor and save as Application
-- ------------------------------------------------------------
--this is required to break the filename into pieces (separate name and extension)
set text item delimiters to "."
tell application "Finder"
set all_files to every item of (choose file with prompt "Choose the Files you'd like to rename:" with multiple selections allowed) as list
display dialog "New file name:" default answer ""
set new_name to text returned of result
--now we start looping through all selected files. 'index' is our counter that we initially set to 1 and then count up with every file.
@thde
thde / whois.conf
Last active January 17, 2025 07:43
/etc/whois.conf WHOIS records for nTLDs.
##
# WHOIS servers for new TLDs (http://www.iana.org/domains/root/db)
# Current as of 2017-12-10 UTC
##
\.aarp$ whois.nic.aarp
\.abarth$ whois.afilias-srs.net
\.abbott$ whois.afilias-srs.net
\.abbvie$ whois.afilias-srs.net
\.abc$ whois.nic.abc
#!/bin/sh
filename="$1"
extension=${filename##*.}
if [ ${extension} = "doc" ]
then
# Use cat doc for older document formats
catdoc "$filename"
else

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';

@hugodias
hugodias / gist:7e73c8c022100d52b6ee
Created May 19, 2014 23:34
Installing MCrypt extension on MAMP
  1. Install homebrew
  2. Update homebrew with brew update
  3. Add josegonzales tap running: brew tap josegonzalez/php
  4. Install mcrypt running brew install php54-mcrypt --without-homebrew-php (php54 => php 5.4.x ; php54 => php 5.3.x, etc ...)
  5. Open your PHP.ini and add extension="/usr/local/Cellar/php54-mcrypt/5.4.24/mcrypt.so"
  6. Restart your apache
@ranacseruet
ranacseruet / VideoStream.php
Last active March 18, 2025 14:40
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@dimsav
dimsav / Country.php
Last active October 17, 2016 13:33
Translatable & Ardent
<?php namespace Dimsav\Translatable\Test\Model;
use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model as Eloquent;
use LaravelBook\Ardent\Ardent;
class Country extends Ardent {
use Translatable {
Translatable::save as translatableSave;