Skip to content

Instantly share code, notes, and snippets.

View wprater's full-sized avatar
💾
Building

Will Prater wprater

💾
Building
View GitHub Profile
@yyx990803
yyx990803 / vue.tmLanguage
Created October 2, 2014 07:40
Vue component syntax definition, which embedded highlight for Stylus, Sass, Less, Jade & CoffeeScript.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>vue</string>
</array>
<key>name</key>
<string>Vue Component</string>
@fpillet
fpillet / gist:270266
Created January 6, 2010 13:18
A UIViewController subclass which automagically releases its UIView-derived instance variables upon -dealloc and -viewDidUnload
/* Base UIViewController subclass for your iPhone applications which automatically
* releases your instance variables pointing to UIView objects or UIView-subclassed objects,
* limiting the work you have to do in -dealloc and -viewDidUnload
*
* All you have to do is make your UIViewController subclasses inherit from BaseUIViewController
* instead of UIViewController
*
* The helper function that disposes of objects is generalized and can be used for other
* types of objects as well.
*
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
@rafaelss
rafaelss / Gemfile
Created May 20, 2010 22:18 — forked from rmanalan/.gems
rack static site
source "http://rubygems.org"
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'
@SFEley
SFEley / deploy.rb
Created August 31, 2010 20:39
Vlad config file with Hoptoad and Unicorn
set :application, "_____"
set :repository, "git@github.com:_____/#{application}.git"
begin
# Parsing the annoying multi-line output of 'git branch'...
set :branch, `git branch --no-color`.match(/\* (.+)/)[1]
rescue Exception => e
set :branch, '(none)'
end
@zerobearing2
zerobearing2 / embedded_callbacks.rb
Created September 5, 2010 19:01
bubble down callbacks to embedded associations with mongoid
# encoding: utf-8
module Mongoid #:nodoc:
module Associations #:nodoc:
module EmbeddedCallbacks
# bubble callbacks to embedded assocaitions
def run_callbacks(*args)
# now bubble callbacks down
self.associations.each_pair do |name, meta|
if meta.association == Mongoid::Associations::EmbedsMany
NSString *urlString = @"http://yourserver.com/upload_huge_file";
NSString *filename = @"filename";
NSString * pathToHugeFileToPost = @"hugeFile";
NSMutableURLRequest * request= [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"---------------------------14737809831466499882746641449";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
@ZhangHanDong
ZhangHanDong / gist:1033906
Created June 19, 2011 07:52
MongoId Counter Cahce
#
# lib/mongoid/counter_cache.rb
# ruby
#
# Created by Zhang Alex on 2011-06-17.
# Copyright 2011 __ZhangHanDong__. All rights reserved.
#
# ===================================
# class Forum
# references_many :topics
@we4tech
we4tech / stage.js
Created August 6, 2011 08:21
Using node-control i've built my deployment script, it was fun and easy to do and go :)
var control = require('control'),
script = process.argv[1],
perform = control.perform,
task = control.task;
var ProjectConfig = {
rootDir: 'staging',
git: 'git://github.com/we4tech/restaurant-review.git',
branch: 'master',
serverPort: 4000
// Neighbours functions, used by findNeighbours function
// to locate adjacent available cells that aren't blocked
// Returns every available North, South, East or West
// cell that is empty. No diagonals,
// unless distanceFunction function is not Manhattan
function Neighbours(x, y)
{
var N = y - 1,
S = y + 1,