Skip to content

Instantly share code, notes, and snippets.

@seanh
seanh / gist:1219425
Created September 15, 2011 14:44
Computing the "full bounding box" of a CCNode in Cocos2D. (Put this code in a CCNode subclass.)
/*!
Return the -boundingBox of another node, converted into this node's local
coordinate space.
*/
-(CGRect) boundingBoxConvertedToNodeSpace:(CCNode *)other
{
// Get the bottomLeft and topRight corners of the other node's bounding box
// in the other node's coordinate space.
CGRect boundingBox = [other boundingBox];
CGPoint bottomLeft = CGPointMake(boundingBox.origin.x, boundingBox.origin.y);
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@emil2k
emil2k / Connectivity.java
Last active December 22, 2023 06:03
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@jpsarda
jpsarda / WaveExplo.shader
Last active August 3, 2022 05:10
Unity (pro) post processing explosion wave effect (need GoKit library). You call it like this : WaveExploPostProcessing.Get().StartIt(myVector2Position);
Shader "Custom/WaveExplo" {
Properties {
_MainTex ("", 2D) = "white" {}
_CenterX ("CenterX", Range(-1,2)) = 0.5
_CenterY ("CenterY", Range(-1,2)) = 0.5
_Radius ("Radius", Range(-1,1)) = 0.2
_Amplitude ("Amplitude", Range(-10,10)) = 0.05
}
SubShader {
//
// RecipePageRenderer.swift
// (c) 2014 Nate Cook, licensed under the MIT License
//
import UIKit
import AVFoundation
/// Units for printing content insets
let POINTS_PER_INCH: CGFloat = 72
@slime73
slime73 / sdl-metal-example.m
Last active September 9, 2021 10:53
SDL + Metal example
/**
* This software is in the public domain. Where that dedication is not recognized,
* you are granted a perpetual, irrevokable license to copy and modify this file
* as you see fit.
*
* Requires SDL 2.0.4.
* Devices that do not support Metal are not handled currently.
**/
#import <UIKit/UIKit.h>
@jonathan-beebe
jonathan-beebe / alasset_to_phasset.swift
Created July 18, 2015 16:26
Convert ALAsset to iOS8+ PHAsset
import Photos
import AVFoundation
func ALAssetToPHAsset(asset:ALAsset) -> PHAsset {
var fetchOptions: PHFetchOptions = PHFetchOptions()
var url:NSURL = asset.valueForProperty(ALAssetPropertyAssetURL) as! NSURL
let fetchResult:PHFetchResult = PHAsset.fetchAssetsWithALAssetURLs([url], options: fetchOptions)
return fetchResult.firstObject as! PHAsset
}
@AndreiRudenko
AndreiRudenko / SpatialHash.hx
Last active May 13, 2019 19:01
SpatialHash uniform-grid implementation
// SpatialHash uniform-grid implementation
// Broad-phase algorithm for collision detection
// Andrei Rudenko // SpatialHash.hx (24.07.2016)
import luxe.Vector;
import luxe.utils.Maths;
class SpatialHash {
public var min(default, null):Vector;
@paniq
paniq / twistpool.c
Last active August 28, 2019 22:17
Twisting Pool Allocator
/*
Twisting Pool Allocator
=======================
written by Leonard Ritter (leonard.ritter@duangle.com)
This file is in the public domain
I don't know if I was the first one to stumble upon this technique, so
I can't guarantee there's no patent on it, but let's hope there's not,
@pingec
pingec / PokemonCP.md
Last active August 6, 2016 18:13
Pokemon CP, IV etc,

Let's say we have 2 pokemons of the same type. Their CP will depend on the following values:

  • IV (IndividualStamina, IndividualAttack, IndividualDefense)
  • CpMultiplier
  • AdditionalCpMultiplier

These values, together with move types, weight, height are what makes your pokemon unique.

Mechanisms that change these values: