Skip to content

Instantly share code, notes, and snippets.

View jquave's full-sized avatar
✔️
jquave

Jameson Quave jquave

✔️
jquave
View GitHub Profile
<script>
$(document).ready(function() {
$('#paypal_submit').click();
});
</script>
void Update() {
Vector2 newVel = new Vector3(walkSpeed * input.horizontal, rigidbody2D.velocity.y);
rigidbody2D.velocity = newVel;
/* Use jumpPressed to start a jump so they have to press it *while* being canJump is true */
if(input.jumpPressed && canJump) {
rigidbody2D.velocity = new Vector2(0,jumpForce);
if(jumpClips!=null & jumpClips.Length>0) {
AudioClip jumpClip = jumpClips[ Mathf.FloorToInt( Random.Range(0,jumpClips.Length-1) ) ];
float xVel = rigidbody2D.velocity.x;
xVel += Time.deltaTime*playerState.playerSettings.walkSpeed*input.directionalPad.x*playerState.playerSettings.walkAcceleration;
float sign = xVel/Mathf.Abs(xVel);
if(Mathf.Abs(xVel)>playerState.playerSettings.maxWalkSpeed) xVel = sign*playerState.playerSettings.maxWalkSpeed;
// TODO: Use a non-animation based method here
if(player.playerAnimation.currentAnimation=="CrowSprint") xVel *= 1.4f; // Speed up in sprint animation
rigidbody2D.velocity = new Vector2(xVel, rigidbody2D.velocity.y);
float xVel = rigidbody2D.velocity.x;
xVel += Time.deltaTime*playerState.playerSettings.walkSpeed*input.directionalPad.x*playerState.playerSettings.walkAcceleration;
float sign = xVel/Mathf.Abs(xVel);
if(Mathf.Abs(xVel)>playerState.playerSettings.maxWalkSpeed) xVel = sign*playerState.playerSettings.maxWalkSpeed;
// TODO: Use a non-animation based method here
if(player.playerAnimation.currentAnimation=="CrowSprint") xVel *= 1.4f; // Speed up in sprint animation
rigidbody2D.velocity = new Vector2(xVel, rigidbody2D.velocity.y);
class func albumsWithJSON(allResults: NSArray) -> [Album] {
// Create an empty array of Albums to append to from this list
var albums = [Album]()
// Store the results in our table data array
if allResults.count>0 {
// Sometimes iTunes returns a collection, not a track, so we check both for the 'name'
@jquave
jquave / Swift chmod +x jamesonquave.com
Created June 16, 2014 22:03
Swift chmod +x jamesonquave.com
#!/usr/bin/env xcrun swift -i -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
import Cocoa
/* Some Swiftyness Here */
In your APIController:
Modify the protocol to understand arrays:
protocol APIControllerProtocol {
func didRecieveAPIResults(results: NSDictionary)
func didRecieveAPIResults(results: NSArray)
}
Add a get function to perform arbitrary gets on URLs
@jquave
jquave / JamesonQuave.com iOS 8 Swift Tutorial Part 6 cellForRowAtIndexPath
Created June 6, 2014 17:04
JamesonQuave.com iOS 8 Swift Tutorial Part 6 cellForRowAtIndexPath
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as UITableViewCell
// Find this cell's album by passing in the indexPath.row to the subscript method for an array of type Album[]
let album = self.albums[indexPath.row]
cell.text = album.title
cell.image = UIImage(named: "Blank52")
cell.detailTextLabel.text = album.price
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as UITableViewCell
if cell == nil {
cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: kCellIdentifier)
}
var rowData: NSDictionary = self.tableData[indexPath.row] as NSDictionary
// Add a check to make sure this exists
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as UITableViewCell
if cell == nil {
cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: kCellIdentifier)
}
var rowData: NSDictionary = self.tableData[indexPath.row] as NSDictionary
// Add a check to make sure this exists