Skip to content

Instantly share code, notes, and snippets.

View chrisbjr's full-sized avatar

Chris Bautista chrisbjr

View GitHub Profile
@m4grio
m4grio / Blueprint.php
Last active June 14, 2019 06:45
Extending Laravel 5 Blueprint for MySqlConnection
<?php
namespace App\Database\Schema;
use Illuminate\Database\Schema\Blueprint as ParentBlueprint;
use Illuminate\Support\Facades\DB;
/**
* Class Blueprint
*
@caseyamcl
caseyamcl / come-on-really.md
Created February 19, 2015 18:20
Ahhhhhhhhh!!!!

HOLY GAWD PEOPLE..

  • Don't write all your new code on the production machine!
  • Use a VCS!
  • Document your functions using DocBlocks!
  • Document your API (at least LIST the endpoints)... I have to decipher the meaning from your code, and that isn't really clear
  • Use a single identifier as the primary ID in the API for a resource (ie don't return a list of group ids for listing groups and then expect the group name as the identifying parameter for modifying a group)
  • Use a consistent model for representing the same data model in different endpoints!
  • Don't concatenate fields in the API results unless there is a good reason to (e.g first name and last name)
  • Don't expose the underlying database logic. This is leaky abstraction, especially when you do it inconsistently!!
@pedrommone
pedrommone / home.blade.php
Created December 23, 2014 11:42
Socket.io implementantion with Redis, Laravel and Node.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Laravel PHP Framework</title>
<style>
</style>
<script src="https://cdn.socket.io/socket.io-1.2.1.js"></script>
@akhoury
akhoury / handlebars-helper-x.js
Last active February 17, 2024 13:25
Handlebars random JavaScript expression execution, with an IF helper with whatever logical operands and whatever arguments, and few more goodies.
// for detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " name == 'Sam' && age === '12' " }}
BOOM