Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@fmtarif
fmtarif / EloquentCheatSheet.md
Created April 25, 2020 21:45 — forked from avataru/EloquentCheatSheet.md
Eloquent relationships cheat sheet
@fmtarif
fmtarif / BackupDatabase.php
Last active April 12, 2020 08:13
#laravel Database dump laravel console command
<?php //from: https://pineco.de/scheduling-mysql-backups-with-laravel/ ?>
<?php
namespace App\Console\Commands;
use File;
use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
@fmtarif
fmtarif / Response.php
Created March 16, 2020 05:06 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@fmtarif
fmtarif / cheat-sheet.js
Created December 31, 2019 11:54 — forked from brianneisler/cheat-sheet.js
Cheat sheet - es6 import/export mixed with require/modules.exports
require('./module.js') // { a: 1 }
import module from './module.js' // undefined
import { a } from './module.js' // 1
require('./module2.js') // { default: { a: 1 }, b: 2 }
import module2 from './module2.js' // { a: 1}
import { b } from './module2.js' // 2
require('./module3.js') // { default: { a: 1 }, b: 2 }
@fmtarif
fmtarif / shopify-oauth.php
Created November 28, 2019 12:01
#php #shopify example app showing Shopify app oAuth flow
<?php
$apiKey = 'your-app-key'; //from partner account app settings
$secret = 'your-secret-key'; //from partner account app settings
$scope = 'read_products,write_products,write_script_tags,read_price_rules,write_price_rules,read_customers,write_draft_orders'; //required permissions
$redirectUri = 'https://app-url'; //this URL has to be in "Whitelisted redirection URL(s)" in shopify partner account app setting
$access_token_url_format = "https://%s/admin/oauth/access_token";
$auth_url_format = "https://%s/admin/oauth/authorize?client_id=%s&scope=%s&redirect_uri=%s";
@fmtarif
fmtarif / curl.php
Last active November 28, 2019 11:55
#php minimal curl post call
<?php
$query = array(
'foo' => 'bar',
);
$url = 'https://example.com/api/url';
$curl = curl_init();
$curlOptions = array(
@fmtarif
fmtarif / angular-rowspan-multilevel.md
Last active October 4, 2019 05:59
#ng #angular angular rowspan multilevel

multilevel-rowspan

  <h1>Static table</h1>
  <table class="ctable">
    <tr>
      <td rowspan="4">1</td>
      <td rowspan="2">1.1</td>
      <td>1.1.1</td>
    </tr>
@fmtarif
fmtarif / postman.js
Created June 20, 2019 13:33
#api Postman - Use Pre-request Script (to populate dynamic variables in request body) and Tests (to make another call from previous call) to make a dependent API call on another
//pre-request scripts tab
moment = require('moment');
pm.environment.set("now_dt", moment());
pm.environment.set("now_ts", 'FOO_' + moment().unix());
//use the following in body
{
"price_rule": {
"title": "{{now_ts}}",

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@fmtarif
fmtarif / VAGRANT-Cheat-Sheet.md
Created June 9, 2019 19:47 — forked from carlessanagustin/VAGRANT-Cheat-Sheet.md
This is a VAGRANT cheat sheet

Vagrant Cheat Sheet

add image

local

$ vagrant box add {title} {url}
$ vagrant init {title}
$ vagrant up