Skip to content

Instantly share code, notes, and snippets.

David Yeiser davidyeiser

Block or report user

Report or block davidyeiser

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
davidyeiser / Post.js
Created Apr 2, 2018
Example Post component for React
View Post.js
import Link from 'next/link'
import dateFormat from 'dateformat'
import Markdown from 'react-markdown'
class Post extends React.Component {
render() {
const {
View componentDidMountCache.js
componentDidMount() {
const cachedAirtableNotes = localStorage.getItem('_cachedAirtableNotes')
if (cachedAirtableNotes) {
// Local data exists, now let's see if it has "expired"
// parse data
const parsedAirtableNotes = JSON.parse(cachedAirtableNotes)
// Check current time against timestamp
View media-queries.scss
// Media Queries
// —·—·—·—·—·—·—·—·—·—·—·—
// NOTE: a 93.75% reduction in full resolution width was
// made for the desktop breakpoints to accommodate
// browser chrome and small vertical spaces in
// approximating a full-screen browser on that
// specific resolution.
davidyeiser / typesetting.sass
Created Jan 12, 2016
Typesetting with Sass
View typesetting.sass
@function pem($target, $context: $em_base)
@return #{$target / $context}em
@function prem($target, $context: $em_base)
@return #{$target / $context}rem
@mixin setFont($face: "regular", $size: 0, $line-height: 0)
$family: "Helvetica Neue", Arial, sans-serif
$style: normal
$weight: normal
davidyeiser / AppDelegate.m
Created Nov 10, 2013
Registering NSUserDefaults
View AppDelegate.m
NSString * const EverydayWeatherUnitTempPrefKey = @"EverydayWeatherUnitTempPrefKey";
NSString * const EverydayWeatherOptShowHelperTaps = @"EverydayWeatherOptShowHelperTaps";
@implementation EverydayWeatherAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// Registers applications default settings
NSArray *dictObjects = [NSArray arrayWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithBool:YES], nil];
davidyeiser / UserSettings.m
Created Nov 6, 2013
Sample user settings retrieval.
View UserSettings.m
// Grab User Settings for units
unitTemp = [[NSUserDefaults standardUserDefaults] integerForKey:@"EverydayWeatherUnitTempPrefKey"];
davidyeiser / temperature.m
Last active Dec 27, 2015
Sample code of grabbing temperature value and then either leaving as-is or converting to °C.
View temperature.m
// Round temperature values to whole integers
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setMaximumFractionDigits:0];
[numberFormatter setRoundingMode: NSNumberFormatterRoundUp];
// Get the current temp from Current Forecast JSON
// Default is °F, convert to °C if User Settings is set to Celcius (0)
if (unitTemp == 1) {
currentTemp = [numberFormatter stringFromNumber:[currently valueForKeyPath:@"temperature"]];
davidyeiser / WeatherAlertsCount.m
Last active Dec 26, 2015
My quick and easy way to distinguish singular from plural when it comes to weather alerts.
View WeatherAlertsCount.m
// "alerts" is the array that contains the weather alerts
int weatherAlertsCount = alerts.count;
NSString *weatherAlertLabelMain = @"";
NSString *weatherAlertLabelMinor = @"";
if (weatherAlertsCount > 1) {
weatherAlertLabelMain = [NSString stringWithFormat:@"%d Weather Alerts", weatherAlertsCount];
else {
davidyeiser / displayCurrentDate.m
Last active Dec 24, 2015
The code I use to display a date label in my weather app.
View displayCurrentDate.m
- (void)displayCurrentDate
// This grabs the current date and initializes it to
// the variable "now"
NSDate *now = [[NSDate alloc] init];
// This initializes the class that turns NSDate objects
// into readable text strings
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
davidyeiser / ViewController.m
Last active Dec 23, 2015
Scroll view setup with basic view controller
View ViewController.m
- (void)viewDidLoad
[super viewDidLoad];
// Get screen size (e.g. iPhone 4 or 5)
CGRect screenSize = [[UIScreen mainScreen] bounds];
// Sets dimensions for the root view and scroll view
[self.view setFrame:CGRectMake(0.0, 0.0, screenSize.size.width, screenSize.size.height)];
[scrollView setFrame:CGRectMake(0.0, 0.0, screenSize.size.width, screenSize.size.height)];
You can’t perform that action at this time.