Skip to content

Instantly share code, notes, and snippets.

View zachmayberry's full-sized avatar

Zachary Mayberry zachmayberry

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zachmayberry
zachmayberry / hub-front-end-notes.md
Last active October 19, 2016 19:50
hub-front-end-notes

Just a couple notes to keep us on the same page:

  • Follow BEM approach to class names (as much as is reasonable without creating extra work for nothing). The benefit of this is making sure that all components are as modular as possible. This means avoiding nested style declarations whenever possible. This doesn’t always make sense, so I’ll give examples of each.

UNNESTED EXAMPLE

Avoid nesting whenever a component could exist anywhere else on the page. Icons are a perfect example, but the general rule should be to lean away from nesting unless it's a completely self contained item with nothing that could be re-used elsewhere.

<div class="hub__navigation">
  <ul>
    <li class="hub__navigation—-item"><a href="#"><i class="hub__icon--home"></i> Home</a></li>
@zachmayberry
zachmayberry / example.m
Created July 30, 2015 16:40
Remove extra cells from UITableView
// Add empty footer to remove extra blank cells from bottom
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
@zachmayberry
zachmayberry / screenheight.m
Created July 30, 2015 16:36
Screen height comparison iOS
CGRect screenBounds = [[UIScreen mainScreen] bounds];
NSLog(@"%d", (int) roundf(screenBounds.size.height));
if ((int) roundf(screenBounds.size.height) < 481) {
return 80.0f;
} else {
return 168.0f;
}
@zachmayberry
zachmayberry / borders.m
Created April 28, 2015 15:13
Add borders to UIView
- (void)addBorders {
// Set thickness
NSInteger borderThickness = 1;
// Comment out each border not needed
UIView *topBorder = [UIView new];
topBorder.backgroundColor = [UIColor lightGrayColor];
topBorder.frame = CGRectMake(0, 0, myView.frame.size.width, borderThickness);
[myView addSubview:topBorder];
UIView *bottomBorder = [UIView new];
@zachmayberry
zachmayberry / package.json
Created November 19, 2014 04:33
Stop using grunt
{
"name": "AbandonGrunt",
"version": "1.0.0",
"description": "A quick test to try to leave grunt behind.",
"main": "main.js",
"watch": {
"lint": "source/js/*.js",
"sass": "source/sass/*.scss"
},
"scripts": {
(function($, _, Backbone) {
// Configuration
var config = {};
config.imageHost = 'https://s3.amazonaws.com/suh-s3-nfs/static/images/Squarespace/';
// Parent object
var Tiles = Tiles || {};
// Model
@zachmayberry
zachmayberry / respawn-pane
Last active October 6, 2016 07:52
Restart tmux pane hanging ssh session
:respawn-pane -k
# http://unix.stackexchange.com/a/88393
@zachmayberry
zachmayberry / parallax.js
Last active January 4, 2016 08:11
Parallax scroll event optimization for changing background images and not disrupting the fluid scroll
/*
Used in conjunction with Scott Robin's backstretch script:
https://github.com/srobbin/jquery-backstretch
*/
(function($) {
var justExecuted = false;
$(window).on('scroll', function() {