This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var rand = Math.random; | |
| var sin = Math.sin; | |
| var cos = Math.cos; | |
| var PI = Math.PI; | |
| var TWO_PI = PI * 2; | |
| | |
| function randomPoint(min, max) { | |
| //generate a random distance between min and max | |
| var dist = rand() * (max - min) + min; | |
| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UIImage *)compressImage:(UIImage *)image{ | |
| float actualHeight = image.size.height; | |
| float actualWidth = image.size.width; | |
| float maxHeight = 600.0; | |
| float maxWidth = 800.0; | |
| float imgRatio = actualWidth/actualHeight; | |
| float maxRatio = maxWidth/maxHeight; | |
| float compressionQuality = 0.5;//50 percent compression | |
| if (actualHeight > maxHeight || actualWidth > maxWidth) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| class StateMachine<P:StateMachineDelegateProtocol>{ | |
| private unowned let delegate:P | |
| private var _state:P.StateType{ | |
| didSet{ | |
| delegate.didTransitionFrom(oldValue, to:_state) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // from http://sbcgamesdev.blogspot.gr/2017/01/phaser-tutorial-how-to-balance-random.html | |
| // converted to JS | |
| // all rights reserved to Tomáš Rychnovský | |
| var RandomBooleanBalancer = function(balancer) { | |
| var _rnd = new Phaser.RandomDataGenerator([0,1]); | |
| var _lbound; | |
| var _ubound; | |
| var _currentBalance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am netgfx on github. | |
| * I am netgfx (https://keybase.io/netgfx) on keybase. | |
| * I have a public key ASBSUuqyWMZXfYNFGy8LPjjsEW-m0MgZXIUJet86AtdEDwo | |
| To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*jslint white: true*/ | |
| /*global Phaser*/ | |
| /** | |
| * Defines a glow filter for Web GL. | |
| * @module | |
| */ | |
| Phaser.Filter.Glow = function (game) { | |
| 'use strict'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Author - Santosh Rajan | |
| import Foundation | |
| let jsonObject: [AnyObject] = [ | |
| ["name": "John", "age": 21], | |
| ["name": "Bob", "age": 35], | |
| ] | |
| func JSONStringify(value: AnyObject, prettyPrinted: Bool = false) -> String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var FirebaseAPI = FirebaseAPI || {}; | |
| FirebaseAPI = { | |
| currentDB: {}, | |
| signInUser: function(loginMail, password) { | |
| window.console.log("trying to login"); | |
| //Show User Name on Main menu screen | |
| ////////////////////////////////////////////////////////////// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| The cake is round, and decorated with M&Ms in a circle around the edge. But while the rest of the cake is uniform, the M&Ms are not: there are multiple colors, and every minion must get exactly the same sequence of M&Ms. Commander Lambda hates waste and will not tolerate any leftovers, so you also want to make sure you can serve the entire cake. | |
| To help you best cut the cake, you have turned the sequence of colors of the M&Ms on the cake into a string: each possible letter (between a and z) corresponds to a unique color, and the sequence of M&Ms is given clockwise (the decorations form a circle around the outer edge of the cake). | |
| Write a function called answer(s) that, given a non-empty string less than 200 characters in length describing the sequence of M&Ms, returns the maximum number of equal parts that can be cut from the cake without leaving any leftovers. | |
| **/ | |
| var pattern = "aaabbbcccddd"; //"abccbaabccba"; //"AZAZZZZAZAZZZZ"; //"aaaaabaaaaab"; //"abcabcabcabc"; //"AABBCCAABBCC";//"AZAZZZZAZAZZZZ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.lang.Math; // headers MUST be above the first class | |
| import java.util.Arrays; | |
| // one class needs to have a main() method | |
| public class HelloWorld | |
| { | |
| // arguments are passed using the text field below this editor | |
| public static void main(String[] args) | |
| { |