Skip to content

Instantly share code, notes, and snippets.

@stuarteske
stuarteske / eloquent-cheatsheet.php
Created May 3, 2017 12:53 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
@stuarteske
stuarteske / gist:d2c1ecd309cf8480b79d
Created March 9, 2016 12:03 — forked from niczak/gist:2501891
PHP Encrypt/Decrypt Class
<?php
class Encryption {
var $skey = "yourSecretKey"; // change this
public function safe_b64encode($string) {
$data = base64_encode($string);
$data = str_replace(array('+','/','='),array('-','_',''),$data);
return $data;
}
@stuarteske
stuarteske / modulename.module
Created November 20, 2015 15:33 — forked from pascalduez/modulename.module
Drupal 7 - Add a cancel button on node forms
<?php
/**
* Implements hook_form_alter().
*/
function modulename_form_alter(&$form, &$form_state, $form_id) {
// You might want to filter by content type.
if ($form_id == 'ctype_node_form') {
// Add a cancel button.
$form['actions']['cancel'] = array(
@stuarteske
stuarteske / maintenance.html
Last active October 8, 2020 18:21 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<head>
<title>Site Maintenance</title>
<style>
*{ margin: 0; padding: 0;}
body { text-align: center; overflow: hidden; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?