Skip to content

Instantly share code, notes, and snippets.

@ma11hew28
ma11hew28 / reverse.c
Last active December 12, 2015 09:29
Reverse a singly linked list in C.
// http://stackoverflow.com/questions/1801549/reverse-a-singly-linked-list
#include <stdio.h>
#include <assert.h>
typedef struct node Node;
struct node {
int data;
Node *next;
};
@ma11hew28
ma11hew28 / NSDecimalNumber+Additions.h
Created May 29, 2011 08:43
Kiwi specs for NSDecimalNumber+Additions (iPhone & iPad)
@interface NSDecimalNumber (Additions)
+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)string scale:(short)scale;
- (NSDecimalNumber *)decimalNumberByRoundingByScale:(short)scale;
@end
@ma11hew28
ma11hew28 / Tile Images.jsx
Created November 21, 2010 16:47
Photoshop script to tile images for iPhone Photo Scroller
// Photoshop Script to Resize & Tile Images
//
// WARNING!!! This script will overwrite (delete perminently) files in the
// selected output folder in the rare case that there are name collisions.
// Therefore, to be safe, it's best to choose an empty output folder.
//
// Copyright (c) 2010 Matt Di Pasquale
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
require 'rubygems'
require 'ruby-debug'
require 'gdata'
require 'pp'
SPREADSHEET_FEED = 'https://spreadsheets.google.com/feeds/spreadsheets/private/full'
client = GData::Client::DocList.new
email = ARGV[0]
@ma11hew28
ma11hew28 / matts-flatten.rb
Created September 9, 2010 05:04
Ruby implementation of flatten for nested arrays
#!/usr/bin/env ruby
class Array
def mattflat
if empty? # base case
self
else
tail = pop
if tail.kind_of? Array
mattflat + tail.mattflat
@ma11hew28
ma11hew28 / .vimrc
Last active September 5, 2015 07:34
.vimrc file
" set nocompatible
syntax on
" set ruler " show [line], [column] of cursor in bottom right of window (hurts performance)
" set nu " show line numbers
" set columns=80
" filetype plugin indent on " load custom settings based on file type
" set spell spelllang=en_us
" set softtabstop=2 shiftwidth=2 expandtab
" set splitright
@ma11hew28
ma11hew28 / .bash_profile
Last active September 4, 2015 20:34
.bash_profile file
# Homebrew, Ruby, Bash Completion
# After upgrading Ruby, run: gem pristine --all --only-executables
export PATH="/usr/local/bin:/usr/local/opt/ruby/bin:$PATH"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Directory Shortcuts
alias prj='cd "$HOME/Projects/"'
@ma11hew28
ma11hew28 / body.rhtml
Created August 29, 2008 02:30
SC custom test view
<%= view :test_view, :view => 'Admin.TestView',
:bind => {:value => 'Admin.masterController.test'} %>
// ==========================================================================
// Admin.AppController
// ==========================================================================
require('core');
/** @class
(Document Your View Here)
// ==========================================================================
// Admin.TopicFeatureView
// ==========================================================================
require('core');
require('views/collection/collection');
require('views/label');
/** @class