Skip to content

Instantly share code, notes, and snippets.

Andrew Barba AndrewBarba

Block or report user

Report or block AndrewBarba

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
@AndrewBarba
AndrewBarba / EpsonDeviceNameToSeries.swift
Created May 25, 2017
Convert Epson printer device name to series enum
View EpsonDeviceNameToSeries.swift
func printerSeries(for name: String) -> Int32 {
switch name.uppercased() {
case "TM-M10":
return EPOS2_TM_M10.rawValue
case "TM-M30":
return EPOS2_TM_M30.rawValue
case "TM-P20":
return EPOS2_TM_P20.rawValue
case "TM-P60":
return EPOS2_TM_P60.rawValue
@AndrewBarba
AndrewBarba / cs6740-space-boilerplate.js
Last active Feb 11, 2016
A boilerplate for the cs6740 space colonization problem written in Javascript. Abstracts away parsing and organizing the data so you can focus on the algorithm needed to solve the challenge.
View cs6740-space-boilerplate.js
'use strict';
/**
* Returns the cheapest way to colonize the given species
* The first argument is an Array of species, and the second argument
* is an array of discounts.
*
* A single species in the array, accesed like species[0], has 2 properties:
* - cost: Int - the cost to bring 1 of these species without a discount
* - needToBring: Int - the number of species I need to bring
View Dispatch.swift
//
// Dispatch.swift
//
// Created by Andrew Barba on 8/25/15.
//
import Foundation
public struct Dispatch {
View sanfrancisco-font.css
/** WARNING - USE AT OWN RISK */
/** IT IS AGAINST APPLE'S POLICY TO USE SF PRO FOR ANYTHING OTHER THAN iOS/tvOS/macOS/watchOS DESIGN & DEVELOPMENT */
/** https://sf.abarba.me/font.css */
/** https://sf.abarba.me/LICENSE.pdf */
/** 1. Copy/import this file into your main css/scss file */
/** 2. Change css font-family: to "SF Text", "SF Display" or "SF Mono" */
/** 3. Apply font-weight or italic to html elements */
/** THANK YOU */
@AndrewBarba
AndrewBarba / make-xcode-fast
Created Apr 14, 2015
Make Xcode (with Cocoapods) faster by cleaning Pods, workspaces, and derived data folders
View make-xcode-fast
xcode-fast:
rm -rf Pods
rm -rf *.lock
rm -rf *.xcworkspace
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod install
@AndrewBarba
AndrewBarba / UIColorMake
Last active Aug 29, 2015
Objective-C macro for easily creating UIColor instances with RGB values between 0 and 255
View UIColorMake
/**
* Example: UIColor *teal = UIColorMake(9.0, 171.0, 161.0, 1.0)
*/
CG_INLINE UIColor*
__UIColorMake(CGFloat r, CGFloat g, CGFloat b, CGFloat a)
{
return [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:a];
}
#define UIColorMake __UIColorMake
View Formatted Phone Number String
/**
* @updated: 2014-07-29
* @source: http://stackoverflow.com/questions/6052966/phone-number-formatting
*/
-(NSString*)phoneNumberString
{
static NSCharacterSet* set = nil;
TL_DISPATCH_ONCE(^{
set = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
});
View jQuery TouchClick
/*** ANDREW BARBA ***/
/**** April 2013 ****/
/********************/
// A replacement for jQuery's .click() event that
// automatically supports taps on mobile devices
// and clicks on desktops
jQuery.fn.touchClick = function(fnc)
{
You can’t perform that action at this time.