Skip to content

Instantly share code, notes, and snippets.

View stuyam's full-sized avatar

Stuart Yamartino stuyam

View GitHub Profile
@graemeboyd
graemeboyd / gist:cc6f4a325283b8ef03d9
Created November 4, 2015 15:01
Dump Heroku database structure and schema
# Sleep 5 tries to avoid Heroku truncating the output by terminating the connection before everything has transferred.
# Dump structure.sql as heroku_structure.sql
heroku run 'bundle exec rake db:structure:dump && cat db/structure.sql && sleep 5' --app app-name > db/heroku_structure.sql
# Dump schema.rb as heroku_schema.db
heroku run 'bundle exec rake db:schema:dump && cat db/schema.rb && sleep 5' --app app-name > db/heroku_schema.rb
@christianhatch
christianhatch / storyboard-viewcontroller-init.swift
Last active January 27, 2022 22:27
A simple UIStoryboard extension to easily instantiate viewcontrollers using Swift type casting. Raw
// Do you often find yourself writing lines of code that look like this?
// let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ViewController") as! ViewController
// Here's a simpler way, using generics and Swift type-casting (as long as the viewcontroller's storyboard identifier is its class name).
// Now you can write: let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController() as ViewController
extension UIStoryboard {
func instantiateViewController<T: UIViewController>() -> T {
guard let vc = instantiateViewControllerWithIdentifier(String(T)) as? T else {
fatalError("Could not locate viewcontroller with with identifier \(String(T)) in storyboard.")
}
@nathanbarrett
nathanbarrett / newlaravel
Created July 18, 2016 17:29
bash function for setting up a laravel project with stuff I almost always use
function newlaravel
{
# Modify to suit your own system
YAML=/home/users/Nathan/Homestead.yaml
PROJECTSDIR="/media/nathan/Secondary Storage/Github"
HOMESTEADDIR="/media/nathan/Secondary Storage/Github"
HOSTFILE=/etc/hosts
PROJECTNAME=$1
#
@MrJackdaw
MrJackdaw / UIView+Border.swift
Last active May 12, 2023 19:02
Swift 3 Extension for adding border to one side of UIView
// This syntax reflects changes made to the Swift language as of Aug. '16
extension UIView {
// Example use: myView.addBorder(toSide: .Left, withColor: UIColor.redColor().CGColor, andThickness: 1.0)
enum ViewSide {
case Left, Right, Top, Bottom
}
@nathanbarrett
nathanbarrett / UsStates.php
Created December 12, 2016 16:49
PHP Class that allows you to access AND format the US States in an array format of your choosing
<?php
namespace App\Helpers;
/*
* Access the US States in a format of your choosing by simply calling:
* UsStates::getStates(array $format, bool $stateAllCaps, bool $includeTerritories)
* check the getStates method below for more details on how to format
*/
class UsStates
{
public static $usStates = [
@mdo
mdo / 00-intro.md
Last active September 2, 2025 03:47
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top