Skip to content

Instantly share code, notes, and snippets.

View almokhtarbr's full-sized avatar
👋

almokhtar almokhtarbr

👋
  • 17:56 (UTC -04:00)
View GitHub Profile
@almokhtarbr
almokhtarbr / postgres cheatsheet.md
Created September 12, 2018 07:33 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@almokhtarbr
almokhtarbr / php-pdo-mysql-crud.md
Created September 12, 2018 16:56 — forked from odan/php-pdo-mysql-crud.md
Basic CRUD operations with PDO and MySQL

Basic CRUD operations with PDO

CRUD = Create, Read, Update, Delete

Open a database connection

$host = '127.0.0.1';
$dbname = 'test';
$username = 'root';
@almokhtarbr
almokhtarbr / bem.less
Created November 21, 2018 09:01 — forked from vivid-web/bem.less
BEM Helper (SCSS, SASS, LESS, Stylus)
// Mixins
.has(@element; @content) {
&__@{element} {
@content();
}
}
.variant(@modifier; @content) {
&--@{modifier} {
@content();
@almokhtarbr
almokhtarbr / export_csv.php
Created February 6, 2019 15:41 — forked from apocratus/export_csv.php
Export MySQL to CSV (php script)
<?php
/* vars for export */
// database record to be exported
$db_record = 'XXXXXXXXX';
// optional where query
$where = 'WHERE 1 ORDER BY 1';
// filename for export
$csv_filename = 'db_export_'.$db_record.'_'.date('Y-m-d').'.csv';
// database variables
@almokhtarbr
almokhtarbr / automatically-set-application-locale.php
Created March 27, 2019 15:04 — forked from paulund/automatically-set-application-locale.php
Automatically Detect Browser Language With PHP
<?php
$supportedLangs = array('en-GB', 'fr', 'de');
$languages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach($languages as $lang)
{
if(in_array($lang, $supportedLangs))
{
@almokhtarbr
almokhtarbr / git-deployment.md
Created August 6, 2019 19:39 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@almokhtarbr
almokhtarbr / cheat_sheet.rb
Created August 25, 2019 01:40 — forked from juanmaree/cheat_sheet.rb
[Ruby Cheat] Cheatsheet #ruby
# This is a comment
# In Ruby, (almost) everything is an object.
# This includes numbers...
3.class #=> Integer
# ...and strings...
"Hello".class #=> String
# ...and even methods!
@almokhtarbr
almokhtarbr / .vimrc
Created September 27, 2019 14:13 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@almokhtarbr
almokhtarbr / deployment_guide.md
Created September 27, 2019 17:48 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
// index.html
<div id="chat">
<ul id="message">
<li v-for="message in messages" :key="message.id">{{ message }}</li>
</ul>
<form @submit="send">
<input type="text" v-model="message">
<button>Send</button>
</form>