Skip to content

Instantly share code, notes, and snippets.

View stuyam's full-sized avatar

Stuart Yamartino stuyam

View GitHub Profile
@mdo
mdo / 00-intro.md
Last active June 25, 2024 18:16
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

@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 = [
@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 / 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
#
@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.")
}
@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
@stuyam
stuyam / _interpolate.scss
Last active January 5, 2016 15:47
This is a Responsive Interpolation mixin for SASS! I built it while building my Poet CSS library http://yamartino.github.io/Poet. Simple give it an element like "h1", then set the size you want that text to be on a large screen, and on a small screen, and it will handle interpolating between the two making a smooth resizing of the text.
// Responsive interpolation mixin, great for making resposive text, but can work on anything.
@mixin interpolate($elements, $min-size, $max-size, $precision: 10, $property: 'font-size', $unit: 'rem', $min-width: 360, $max-width: 960){
$increment: ($max-size - $min-size)/$precision;
@for $i from $precision through 0{
@if $i == $precision{
#{$elements}{
#{$property}: #{$max-size - $i * $increment}#{$unit};
}
} @else {
@media only screen and (min-width: #{$max-width - $i * ($max-width - $min-width)/$precision}px) {
@kshnurov
kshnurov / jquery.photoswipe.js
Created February 23, 2015 23:37
PhotoSwipe: init from DOM using jQuery
(function( $ ) {
$.fn.photoswipe = function(options){
var galleries = [],
_options = options;
var init = function($this){
galleries = [];
$this.each(function(i, gallery){
galleries.push({
id: i,
@danawoodman
danawoodman / 0-react-hello-world.md
Last active March 9, 2024 00:32
React Hello World Examples

React "Hello World" Examples

Below are a small collection of React examples to get anyone started using React. They progress from simpler to more complex/full featured.

They will hopefully get you over the initial learning curve of the hard parts of React (JSX, props vs. state, lifecycle events, etc).

Usage

You will want to create an index.html file and copy/paste the contents of 1-base.html and then create a scripts.js file and copy/paste the contents of one of the examples into it.

@magicznyleszek
magicznyleszek / css-selectors.md
Last active March 29, 2024 01:12
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {