Skip to content

Instantly share code, notes, and snippets.

View chadwithuhc's full-sized avatar

cheddar chadwithuhc

View GitHub Profile
@chadwithuhc
chadwithuhc / hooks.php
Created April 9, 2014 00:25
Rocketeer PHP Hook Sample
<?php
/**
* Used to run any after deploy tasks:
* - Migrate DB
* - Clear expired password reminder tokens
* - Clear caches
* - Remove any unwanted files from the server
*/
$deploy_cleanup = function ($task) {
@chadwithuhc
chadwithuhc / rename_module.sh
Created October 24, 2012 21:31 — forked from HighwayofLife/rename_module.sh
Rename/Duplicate PyroCMS Module Bash Script
#!/bin/bash
##
# Modified version of https://gist.github.com/3680107
#
# Tested for use on Mac OS X 10.7.5 with Bash 3.2.48(1)-release
#
# Old module needs to be in system/cms/modules and a single word (Ex: blogs not site_blogs)
##
@chadwithuhc
chadwithuhc / LEX.html
Last active December 16, 2015 17:29
A simple modification to the Pages Plugin to allow including children inside `{{ pages:children }}`.<br> Ex: `{{ pages:children id="1" include-children="true" }} ... {{ /pages:children }}`<br> NOTE: Only a single level of children are pulled in since nesting tags in LEX throw errors. This is not a solution for multiple levels of children. This c…
<ul>
{{ pages:children id="1" include-children="true" }}
<li>{{ id }} - {{ url }}
{{ if children }}
<ul>
{{ children }}
<li>{{ id }} - {{ url }}</li>
{{ /children }}
</ul>
{{ endif }}
@chadwithuhc
chadwithuhc / questions.md
Last active November 12, 2016 03:27
Front End Engineer Interview Questions

HTML / CSS

  • What are some new features in HTML5 / CSS3?
  • What are the differences of using float vs inline-block?
  • Describe Floats and how they work in detail
  • Explain differences between inline and inline-block
  • Can you explain the differences between em, rem, px?
  • Explain reset.css vs normalize.css
  • How do display: none vs visibility: hidden differ?
  • What is the difference between classes and IDs in CSS?
@chadwithuhc
chadwithuhc / ORMs.md
Last active January 13, 2017 18:05
ORMs Slides

ORM

Object Relational Mapper


Object ... We're working with objects (as in database rows)

Relational ... Specifically handling relational data

(function() {
'use strict'
angular.module('app')
.service('houseService', function () {
this.houses = [
{id: 1, name: 'Spacious two bedroom', address: '10 Main St'},
]
this.seedHouses = function() {

The error was most likely caused by a brew upgrade command that upgraded postgres and now no longer connects correctly.

You can follow the commands below but you will lose prior databases.

$ brew services stop postgres
$ cd /usr/local/var
$ ls
@chadwithuhc
chadwithuhc / index.html
Created November 10, 2017 22:11
DOM Events Sample
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
nav {background: tomato}
</style>
@chadwithuhc
chadwithuhc / declaring-values-in-function.js
Last active February 7, 2018 00:05
React Refactors for Clean Code
// Challenge: Refactor the `render()` method with declare all variables at top
render() {
return (
<li>
<div className="profile-card">
<header className="profile-header" onClick={this.toggleClass}>
<img src={this.props.profile.image} alt={this.props.profile.name} />
<h2>{this.props.profile.name}</h2>
</header>
@chadwithuhc
chadwithuhc / url-params.js
Created February 7, 2018 04:44
JavaScript Pro Tips
// Challenge: Pull out the "character" value from the following URL string
// http://localhost:3000/characters/new?character=Art+Vandelay
// Using the `URL()` API, we can pull out the search params without needing to regex, split, or other wonkery
const params = (new URL(url)).searchParams
params.get('character') // Art Vandelay
// `URL()` will also handle uri decoding -- urls with %20, +, etc.