Skip to content

Instantly share code, notes, and snippets.

View nuclearghost's full-sized avatar
🚀
Lost in Space

Mark Meyer nuclearghost

🚀
Lost in Space
  • TravelJoy
  • Chicago, IL
View GitHub Profile
@nuclearghost
nuclearghost / app.js
Created October 11, 2017 22:04
Parse Cloud Front User Agents
fs = require('fs');
parse = require('user-agent-parser');
// parse('user agent string')
var total = 0,
iOS = 0,
iOS10 = 0,
iOS9 = 0,
Android = 0,
AndroidChrome52 = 0,
@nuclearghost
nuclearghost / Gemfile
Created December 15, 2016 17:23
Simple Sinatra Server That Sets Cookies
# frozen_string_literal: true
source "https://rubygems.org"
gem "sinatra"
gem "sinatra-contrib"
alert('yo');
@nuclearghost
nuclearghost / detector.js
Created March 2, 2016 18:40
Mobile UA Detector
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i)
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i)
},
iOS: function() {
return navigator.userAgent.match(/iPad|iPod|iPhone/i)
},
@nuclearghost
nuclearghost / addDone.swift
Created December 23, 2015 02:13
Add done button to Numeric Keypad
@IBOutlet weak var numberTextField: UITextField!
@IBOutlet weak var numberTextField2: UITextField!
//Assumes that the tag's of the views are sequential
override func viewDidLoad() {
numberTextField.tag = 1
numberTextField.tag = 2
addDoneButtonTo(numberTextField)
addDoneButtonTo(numberTextField2)
}
@nuclearghost
nuclearghost / gif_gen.sh
Created September 15, 2015 19:48
Create a gif from a mp4 using ffmpeg
#!/bin/bash
input_video=$1
starting_second=$2
lenght_in_seconds=$3
output_file=$4
palette="/tmp/palette.png"
filters="fps=15,scale=320:-1:flags=lanczos"
@nuclearghost
nuclearghost / index.md
Last active August 29, 2015 14:23
Swift Learning Resources

#Swift Resources

This is a set of open source resources that are useful for learning about app development in swift

Applicaions

  1. Todo Swift A simple Todo app written in swift. Shows how to enter text and some basic interactions with a UITableView
  2. Swift RSS Sample This is a simple app that injests a hardcoded RSS feed and displays the data in UITableView. This uses cocoapods which is the most widely used dependency maanger for developing iOS apps.
  3. Swift NYT Reader
@nuclearghost
nuclearghost / gist:ff33136e5bc883c8abbf
Created December 7, 2014 21:53
iOS Fonts available
for (NSString* family in [UIFont familyNames])
{
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family])
{
NSLog(@" %@", name);
}
}
@nuclearghost
nuclearghost / UIColorFromRGB
Last active August 29, 2015 14:06
Create a UIColor from a Hex Value
func UIColorFromRGB(rgbValue: UInt) -> UIColor {
return UIColor(
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
alpha: CGFloat(1.0)
)
}
//Call with UIColorFromRGB(0x209624)
@nuclearghost
nuclearghost / CustomLog.m
Last active August 29, 2015 14:05
Objective C Custom Log Macros
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)