Skip to content

Instantly share code, notes, and snippets.

View meabed's full-sized avatar
👨‍💻
Coding

Mohamed Meabed meabed

👨‍💻
Coding
View GitHub Profile
@meabed
meabed / mpnml
Created February 17, 2014 06:13 — forked from holms/mpnml
sudo port -v install mysql5-server
# Don't do any post-install instructions
sudo -u _mysql mysql_install_db5
# if above command produce this error: ERROR: 1004 Can't create file '/var/tmp/#sqle967_1_0.frm' (errno: 9)
# do this:
# sudo chown -R mysql:mysql /opt/local/var/db/mysql5
# sudo chmod u+rwx,go= /opt/local/var/db/mysql5
# sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
<?php
/**
* Merge two dimensional arrays my way
*
* Will merge keys even if they are of type int
*
* @param array $array1 Initial array to merge.
* @param array ... Variable list of arrays to recursively merge.
*
angular.module('globalmodule')
.config(['$provide', '$httpProvider', function($provide, $httpProvider){
$provide.factory('GlobalAjaxInterceptor', ['$q', '$rootScope', function($q, $rootScope){
var currentRequests={http: {}, ajax: {}};
function addHttpRequest(conf){
currentRequests.http[conf.url] = conf.promiseObj;
}

Most web traffic should be available over HTTPS. AWS makes this easy with Elastic Load Balancers (ELBs). When configured with an SSL certificate, an ELB will perform SSL termination and forward the traffic onto our group of non-encrypted web server instances.

Using an ELB is advantageous to offload many responsibilities to Amazon:

Maintaining uptime for the primary service DNS name Balancing traffic to one or more instances Re-balancing traffic when instances are added, removed, or become unhealthy Storing and applying your mission-critical secret SSL certificate Configuring critical aspects of HTTP like what SSL protocols, cypher and options are available and permitted

@meabed
meabed / crontab file
Last active August 29, 2015 14:26 — forked from josh-padnick/crontab file
Create EC2 AMI from Bash Script; Good for cron jobs
PATH=/bin:/usr/local/bin
# Put this in your crontab file to run the script every day at 01:30 (1:30am). Note the PATH variable above; required for this script.
# m h dom mon dow command
30 01 * * * /bin/bash /home/ubuntu/scripts/ec2-create-image.sh i-8a915682 >> /home/ubuntu/logs/crontab.log 2>&1
@meabed
meabed / nginx-cors.conf
Last active September 9, 2015 17:51 — forked from sbuzonas/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "";
"~^https?://(?:[^/]*\.)?(stevebuzonas\.(?:com|local))(?::[0-9]+)?$" "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@meabed
meabed / build_nginx.sh
Created January 3, 2016 01:21 — forked from MattWilcox/build_nginx.sh
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# names of latest versions of each package
export VERSION_PCRE=pcre-8.38
export VERSION_OPENSSL=openssl-1.0.2d
export VERSION_NGINX=nginx-1.9.7
# URLs to the source directories
export SOURCE_OPENSSL=https://www.openssl.org/source/
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
@meabed
meabed / app.js
Created January 7, 2016 12:57 — forked from dylants/app.js
Passport security using local authentication (username/password)
require("express-namespace");
var express = require("express"),
fs = require("fs"),
cons = require("consolidate"),
app = express(),
passport = require("passport"),
mongoose = require("mongoose");
// 30 days for session cookie lifetime
var SESSION_COOKIE_LIFETIME = 1000 * 60 * 60 * 24 * 30;