Skip to content

Instantly share code, notes, and snippets.

@jimitit
jimitit / FK Maker
Created July 7, 2016 06:24
FK Maker
<?php
$dsn = 'mysql:host=localhost;dbname=information_schema';
$username = 'root';
$password = 'password';
$dbh = new PDO($dsn, $username, $password);
$tableSchema = 'db_name';
$fkColumnName = 'emp_id';
$pkColumnName = 'admin_id';
$pkTableName = 'admin_login';
@jimitit
jimitit / eloquent.md
Created September 8, 2016 13:17 — forked from msurguy/eloquent.md
Laravel 4 Eloquent Cheat Sheet.

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

@jimitit
jimitit / Angular 2 + Laravel Nginx Configuration
Created March 29, 2017 14:50
Angular 2 + Laravel Nginx Configuration
server {
listen 80;
#listen [::]:80;
server_name dev.hio.com;
root /Users/jimit/Code/rl_projects/hio/api/public;
access_log /Users/jimit/Code/rl_projects/hio/api/storage/local/nginx.access.log;
error_log /Users/jimit/Code/rl_projects/hio/api/storage/local/nginx.error.log;
location / {
alias /Users/jimit/Code/rl_projects/hio/front/dist/;
try_files $uri $uri/ /index.html?$args;
@jimitit
jimitit / class.database.php
Created September 6, 2017 11:29 — forked from jonashansen229/class.database.php
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
@jimitit
jimitit / debounce.js
Created July 20, 2018 16:22 — forked from luan0ap/debounce.js
Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds.
const debounce = (fn = () => {}, wait = 1000) => (...args) => {
const delayed = () => fn.apply(this, args)
return setTimeout(delayed, wait)
}