Skip to content

Instantly share code, notes, and snippets.

@christianhanvey
christianhanvey / modx-snippets.php
Last active June 14, 2023 13:02
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@dylanburkey
dylanburkey / Slim App
Last active November 26, 2017 06:32
Slim MySQLi Integration
<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim(); $app->get('/', function () use ($app) {
require_once 'lib/mysql.php';
$db = connect_db();
$result = $db->query( 'SELECT id, name, job FROM friends;' );
while ( $row = $result->fetch_array(MYSQLI_ASSOC) ) {
$data[] = $row;
}
@hassansin
hassansin / eloquent-cheatsheet.php
Last active May 23, 2024 07:51
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*/
#!/bin/bash
###################################
# Usage: sudo ./installer.sh [os] #
###################################
OS=$1;
UBUNTU="ubuntu";
#############