- StudlyCaps for class names, namespaces and file names of classes
- camelCase for property, method and variable names
- UPPER_SNAKE_CASE for constants
- snake_case for service and parameter names in the Symfony service container and for names of templates and configuration files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var path = require('path'); | |
var livereload = require('gulp-livereload'); | |
var API_HTML = 'index.html'; | |
var API_DEST = './public/project/reference/v1'; | |
function raml2html(options) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
box: laravel/homestead-7 | |
version: 0.2.1 | |
ip: "192.168.10.20" | |
memory: 2048 | |
cpus: 1 | |
name: antifraud | |
provider: virtualbox | |
authorize: ~/.ssh/id_rsa.pub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"page": 1, | |
"pageSize": 2, | |
"rowCount": 380, | |
"pageCount": 190 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Routes Parameters | |
/** | |
* Get a given parameter from the route. | |
* | |
* @param $name | |
* @param null $default | |
* @return mixed | |
*/ | |
function route_parameter($name, $default = null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Search recursive | |
array_search($value, array_column($resource, 'key')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Allow from any origin | |
if (isset($_SERVER['HTTP_ORIGIN'])) { | |
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one | |
// you want to allow, and if so: | |
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); | |
header('Access-Control-Allow-Credentials: true'); | |
header('Access-Control-Max-Age: 86400');// cache for 1 day | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('click', '.pagination a', function (e) { | |
$('.pagination').find('li').removeClass('active disabled'); | |
$(this).parent().addClass('active'); | |
let page = $(this).attr('href').split('page=')[1]; | |
let request = $.ajax({url : 'todo?page=' + page, dataType: 'json'}); | |
request.done(function (res) { | |
// handle res |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(){ | |
fetch('/endpoint', {method: 'get'}).then(function (response) { | |
return response.json(); | |
}) | |
.then(function (body) { | |
console.log(body); | |
}); |