Skip to content

Instantly share code, notes, and snippets.

View itsjustcon's full-sized avatar

Connor Grady itsjustcon

View GitHub Profile
@itsjustcon
itsjustcon / LESScompiler.js
Last active May 1, 2021 06:28
Uses Node.js to compile LESS files (on file change) into compressed css automatically! This simple script has saved me hours of compile & versioning mistakes by compiling everything automatically per-file! 1. Drop LESScompiler.js and struct.json into a folder with all your LESS files 2. Modify struct.json to fit your file names & output location…
var less = require('less'),
fs = require('fs'),
path = require('path'),
struct = path.join(__dirname,'struct.json'),
files = {};
// Watch current folder & compile if file from files{} has changed
fs.watch(__dirname,function (evt, file) {
file = path.relative(__dirname,file);
if ( !file || !files[file] ) return;
@itsjustcon
itsjustcon / JScompiler.js
Last active December 16, 2015 00:39
A simple JavaScript pre-processing script using Node.js that uglifies/minifies multiple js files into a single js file. Drastically reduces the number of GET requests by mixing all required js files into one. 1. Drop JScompiler.js and struct.json into a folder with all your js files 2. Modify struct.json to fit your file names, included files/im…
var UglifyJS = require('uglify-js');
fs = require('fs'),
path = require('path'),
struct = path.join(__dirname,'struct.json'),
files = {};
// Watch current folder & compile if file from files{} has changed
fs.watch(__dirname,function (evt,file) {
file = path.relative(__dirname,file);
if (!file) return;
@itsjustcon
itsjustcon / minify.js
Created May 15, 2013 22:24
Packages UglifyJS into a nice, lightweight command-line tool for minifying JavaScript files.
// CREATED BY:
// Connor Grady on May 15, 2013
// http://connorgrady.com/
// USAGE:
// node minify myfile.js
// node minify file1.js file2.js file3.js
// OUTPUT:
// file1.js --> file1.min.js
var UglifyJS = require('uglify-js'),
@itsjustcon
itsjustcon / UIColor+Hex.mm
Created June 10, 2013 19:31
Get UIColor from HEX in Objective-C. Great for programmatically creating color swatches on iOS + OS X!
+ (UIColor *) colorFromHexCode:(NSString *)hexString {
NSString *cleanString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""];
if([cleanString length] == 3) {
cleanString = [NSString stringWithFormat:@"%@%@%@%@%@%@",
[cleanString substringWithRange:NSMakeRange(0, 1)],[cleanString substringWithRange:NSMakeRange(0, 1)],
[cleanString substringWithRange:NSMakeRange(1, 1)],[cleanString substringWithRange:NSMakeRange(1, 1)],
[cleanString substringWithRange:NSMakeRange(2, 1)],[cleanString substringWithRange:NSMakeRange(2, 1)]];
}
if([cleanString length] == 6) {
cleanString = [cleanString stringByAppendingString:@"ff"];
@itsjustcon
itsjustcon / node-install.sh
Last active December 19, 2015 04:28
Easy script for installing Node.js! Tested on Amazon's Ubuntu Server AMI
#!/bin/sh
# Author: Connor Grady (connorgrady.com)
# USAGE: sudo sh node-install.sh
version='v0.10.21' # check nodejs.org for this
echo 'INSTALLER: Welcome to the Node.js easy installer for Ubuntu. Going through first round of updates + installs...'
start_time=`date +%s`
sudo apt-get update -y
sudo apt-get install build-essential g++ curl apache2-utils git-core -y
@itsjustcon
itsjustcon / .gitignore
Last active December 25, 2015 10:59
Basic gitignore file for iOS-based projects using CocoaPods.
# DESCRIPTION: gitignore file for iOS-based projects using CocoaPods
# AUTHOR: Connor Grady (connorgrady.com)
# SOURCE: https://gist.github.com/itsjustcon/6965920
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
#!/bin/bash
# INSTALL: sudo wget <RAW link from gist here> -O /usr/bin/pifinder; chmod 755 /usr/bin/pifinder;
# USAGE: pifinder
# pifinder 192.168.1.*
# pifinder 192.168.*.*
# RPi Connect function
connect () {
echo "Connecting to Raspberry Pi at $1 now..."
@itsjustcon
itsjustcon / log-manager.js
Created April 26, 2014 22:32
Tool to enable/disable standard output (loggers, errors, etc.)
var stdout_write = undefined;
var Log = function (value) {
var shouldRelock = Log.unlock();
/** Forward call to console.log */
console.log.apply(this, arguments);
@itsjustcon
itsjustcon / SRLogViewController.h
Created May 14, 2014 18:05
View all your DDLog messages in a nice terminal-style view controller! Don't forget to call: `[DDLog addLogger:myLogViewController]`
//
// SRLogViewController.h
//
// Created by Connor Grady on 4/25/14.
// Copyright (c) 2014 Stadium Runner. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CocoaLumberjack/DDLog.h>
@itsjustcon
itsjustcon / todo.md
Last active August 29, 2015 14:07
Web App Todo

Web App Todo

General

  • randomly pull promo code(s) from menu & submit w/ order
    • add to settings quickly for bryant?
    • display to beta user how many (if any) promos got submitted
  • custom popup messages
  • if getting menu for seat and server responds with status code xxx, force reload the page in js