This file contains 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
public static Random random = new Random(DateTime.Now.Millisecond); | |
public int chooseWithChance(params int[] args) | |
{ | |
/* | |
* This method takes number of chances and randomly chooses | |
* one of them considering their chance to be choosen. | |
* e.g. | |
* chooseWithChance(1,99) will most probably (%99) return 1 since index of 99 is 1 | |
* chooseWithChance(99,1) will most probably (%99) return 0 since index of 99 is 0 | |
* chooseWithChance(0,100) will always return 1. |
This file contains 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
/* ---------------------------------- | |
Minimal Theme for prettyPhoto lightbox | |
http://tutorialspage.com/pretty-photo-minimal-theme-a-pure-css-prettyphoto-simple-theme | |
----------------------------------- */ | |
div.minimal { overflow: hidden; } | |
div.minimal .pp_gallery li.default a, div.minimal .pp_next, div.minimal a.pp_previous { background: none; } /* Cancel bg load */ | |
div.minimal .pp_top, div.minimal .pp_top .pp_middle, div.minimal .pp_top .pp_left, div.minimal .pp_top .pp_right, div.minimal .pp_bottom, div.minimal .pp_bottom .pp_left, div.minimal .pp_bottom .pp_middle, div.minimal .pp_bottom .pp_right { height: 13px; display: none; } | |
div.minimal .pp_content_container .pp_left { padding-left: 13px; } | |
div.minimal .pp_content_container .pp_right { padding-right: 13px; } | |
div.minimal .pp_content { background-color: #fff; margin-bottom: -36px; } |
This file contains 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
/* | |
Took me a while to figure this out, this should never be so difficult IMHO. The dynamodb api could use more examples in its doc. | |
The documentation for doing this is scattered in a few places: | |
1. dynamodb api doc for golang: https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/ | |
2. the Update Expression: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html | |
The structs belowed are abbreviated for the sake of the demo: adding a string to the questions slice in the dynamodb table. |
This file contains 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
//////////////////////////////////////// | |
// Find PhysX components that will trigger the Unity 2018 complaint about | |
// kinematic with Continuous Collision Detection: | |
// | |
// ERROR: [Physics.PhysX] RigidBody::setRigidBodyFlag: kinematic bodies with CCD enabled are not supported! CCD will be ignored. | |
// | |
// Use the script to find troublesome components in the scene or in the project | |
// then manually change them to a valid value, likely ContinuousSpeculative | |
// | |
// See https://docs.unity3d.com/ScriptReference/CollisionDetectionMode.ContinuousSpeculative.html |