Skip to content

Instantly share code, notes, and snippets.

View dylan's full-sized avatar
📡

Dylan Wreggelsworth dylan

📡
View GitHub Profile
/////// RopeNode.h
#import "cocos2d.h"
#import "ObjectiveChipmunk.h"
struct RopeNodeParticle;
@interface RopeNode : CCNode {
ChipmunkBody *_body1, *_body2;
cpVect _offset1, _offset2;

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@iamkvein
iamkvein / hook_method.js
Created March 9, 2012 14:32
Improved way of temporarily replacing a method on an object
var install_hook_to = function(obj) {
if (obj.hook || obj.unhook) {
throw new Error('Object already has properties hook and/or unhook');
}
obj.hook = function(_meth_name, _fn, _is_async) {
var self = this,
meth_ref;

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@eternalstorms
eternalstorms / Apple Evangelists.txt
Created June 12, 2013 09:07
Apple Evangelists (WWDC 2013)
UI- and App Frameworks Evangelist - Jake Behrens, [email protected], twitter: @Behrens
- What's new in Cocoa
- Accessibility in iOS
- Building User Interfaces for iOS 7
- Getting Started with UIKit Dynamics
- What's new in Cocoa Touch
- What's New With Multitasking
- Best Practices for Cocoa Animation
- Improving Power Efficiency with App Nap
- Introducing Text Kit
@dylan
dylan / drinks.md
Last active December 20, 2015 07:29
Several of my favorite cocktails, transcribed as I perfect them or discover them.

San Salvador

  • 1.5oz dark rum
  • 1oz triple sec
  • 0.5oz lime juice
  • 1.5oz orange juice

Daiquiri - ***

  • 2oz Rum
  • 1/2 or 1oz Lime juice (usually about one lime's worth of juice)
  • 1 tsp. simple syrup, add more to taste.
@prime31
prime31 / Vector3Editor.cs
Last active August 23, 2018 20:27
Ever get tired of creating piles of GameObjects just because you want a Vector3 position? Those days are over. The Vector3Editor will let you edit single Vector3 properties and arrays of Vector3's without having to create a plethora of GameObjects.
// Usage:
// - stick the Vector3Editor.cs file in the Editor folder of your project
// - create a class with a Vector3 or Vector3[] property (you probably already have plenty of them. The WarpZone class below is a simple example)
// - create an editor script for any the class that you want to be able to edit extending Vector3Editor (see WarpZoneEditor below)
// - in OnEnable simply call setup() with your property names and optional labels
using UnityEngine;
using UnityEditor;
@drhurdle
drhurdle / Xoroshiro128Plus.swift
Last active May 20, 2016 19:27
Pseudo-Random Number generator utilizing xoroshiro128+ algorithm in Swift 2.2
import Foundation
/// Pseudo-Random Number generator utilizing xoroshiro128+ algorithm
/// translated from: http://xoroshiro.di.unimi.it/xoroshiro128plus.c
/// Example:
/*
var myRNG = RNG()
var x = myRNG.getRandomNumber(0,100)
var r = RNG(seed: 2345) // Seed is the same as {s} below
@sketchpunk
sketchpunk / QuaterionSpring.js
Created November 17, 2018 06:07
Spring Physics - Oscillation and Critical Dampening on Quaternions
// Resources
// https://burakkanber.com/blog/physics-in-javascript-car-suspension-part-1-spring-mass-damper/
// https://gafferongames.com/post/spring_physics/
// https://gafferongames.com/post/physics_in_3d/
// http://digitalopus.ca/site/pd-controllers/
// .. Has things about Torque
class QuaterionSpring{
constructor( damping=5, stiffness=30 ){
this.velocity = new Float32Array(4);
@ompuco
ompuco / PSXDither.hlsl
Last active November 1, 2024 04:01
Color dither & truncation based on Sony's PlayStation (1) hardware features & limitations.
#ifdef PSXDTH
#else
#define PSXDTH
//PS1 Hardware Dithering & Color Precision Truncation Function
//by ompu co | Sam Blye (c) 2020
//PS1 dither table from PSYDEV SDK documentation