Skip to content

Instantly share code, notes, and snippets.

View mdjaman's full-sized avatar
🏠
Working from home

Marcel Djaman mdjaman

🏠
Working from home
View GitHub Profile
<?php
namespace MyNamespace\YouTube;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* @ODM\Document(db="analytics", collection="youtube")
* @ODM\InheritanceType("SINGLE_COLLECTION")
* @ODM\DiscriminatorField("type")
@mdjaman
mdjaman / The Technical Interview Cheat Sheet.md
Created May 29, 2017 14:01 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@mdjaman
mdjaman / .htaccess
Created May 22, 2017 11:16 — forked from jonathonbyrdziak/.htaccess
htaccess mod_expires / mod_cache / mod_deflate / mod_headers
# ------------------------------------------------------------------------------
#
# Curtousy of the Magento Support Center
# http://magentosupport.help/what-are-expires-headers-and-how-do-i-implement-them/
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# | Mod Caching via Apache |
@mdjaman
mdjaman / statuses.md
Created April 28, 2017 00:22 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@mdjaman
mdjaman / del.txt
Created April 8, 2017 16:48 — forked from aslakhellesoy/del.txt
Delete redis keys by wildcard
eval "return redis.call('del', unpack(redis.call('keys', 'foo.*')))" 0
@mdjaman
mdjaman / mysql.txt
Created December 21, 2016 10:52 — forked from johnantoni/mysql.txt
mysql + vagrant + remote access
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf
@mdjaman
mdjaman / Module.php
Created November 17, 2016 15:57 — forked from juriansluiman/Module.php
Set a default locale for your application in Zend Framework 2
<?php
namespace Application;
use Locale;
use Zend\EventManager\Event;
use Zend\ModuleManager\Feature;
class Module implements
Feature\BootstrapListenerInterface
{
@mdjaman
mdjaman / numberformat.js
Created November 17, 2016 10:40
number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP. It formats a number to a string with grouped thousands, with custom seperator and custom decimal point
function number_format(number, decimals, decPoint, thousandsSep){
decimals = decimals || 0;
number = parseFloat(number);
if(!decPoint || !thousandsSep){
decPoint = '.';
thousandsSep = ',';
}
var roundedNumber = Math.round( Math.abs( number ) * ('1e' + decimals) ) + '';
@mdjaman
mdjaman / strip_tags.js
Created September 26, 2016 12:24 — forked from muhittin/strip_tags.js
strip_tags for Javascript
var text = '<div class="foo">bar</div>';
text.replace(/(<([^>]+)>)/ig,""); // Returns: bar
@mdjaman
mdjaman / install.sh
Created August 19, 2016 10:06 — forked from Fridus/install.sh
Install wkhtmltopdf
#!/usr/bin/env bash
_UVERSION=${1:-precise}
_WVERSION=0.12.2.1
_WVERSION_M=`echo $_WVERSION | awk -F. '{print $1"."$2}'`
FILENAME="wkhtmltox-${_WVERSION}_linux-${_UVERSION}-amd64.deb"
URL="http://download.gna.org/wkhtmltopdf/${_WVERSION_M}/${_WVERSION}/${FILENAME}"
apt-get update