Skip to content

Instantly share code, notes, and snippets.

@sgelbart
sgelbart / readme.md
Created July 27, 2019 20:44
AWS Cloud9 Django
@sgelbart
sgelbart / README.md
Created March 13, 2018 21:00 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@sgelbart
sgelbart / firebase-example.html
Created December 10, 2017 22:39
A simple firebase example for reading and writing database records realtime.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Order Form</title>
<?php
Validator::extend('combinedUnder3', function ($attribute, $value, $parameters, $validator)
{
$data = $validator->getData();
return ($data->number1 + $data->number2) < 3;
});
?>
@sgelbart
sgelbart / gist:6a37a8216aa8f1fa406b
Last active August 29, 2015 14:25
Static Table Seeds
**STATIC TABLE SEEDS**
problem
There's no elegant way for seeding application data that you want versioned and mirrored on all our servers. You can create traditional seeds but you end up reseeding all your application data each time (which is annoying with large tables) or you have to do some wonky work arounds for each server.
characteristics of STATIC tables
- table data should match per server, the same way file data does
- data should never be added by users
- code data is dependent upon
- there should not be any coupling based on this data, e.g., it should not send any alerts/messages that would depend upon “create” events etc
@sgelbart
sgelbart / LaravelEasyGlobalScope.php
Last active September 22, 2016 09:55
Any easy implementation for laravel in-model global scopes (basic testing in Laravel 4.2)
<?php
//USAGE
//in your model
public function scopeGlobal($query)
{
//todo: there may be a bug where you can't use nested wheres..try with ->where(function($query){return MyModel::noEasyGlobal();}
return MyModel::noEasyGlobal()->where('is_published',1); //replace this with whatever criteria you ahve