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
| // get current time when page is first run | |
| // (the + prefix is magic that will cast it into a timestamp) | |
| var startTimestamp = +new Date(); | |
| window.addEventListener('beforeunload', function () { | |
| // get current time when the beforeunload event is fired | |
| var endTimestamp = +new Date(); | |
| // calculate deltas | |
| var deltaTimestamp = endTimestamp - startTimestamp; |
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
| void spread(Transform area, ref GameObject[] array) { | |
| int l = array.Length; | |
| if (l > 1) { | |
| Vector3 center = area.collider.bounds.center, extents = area.collider.bounds.extents; | |
| float top = center.y + extents.y, | |
| bottom = center.y - extents.y; | |
| bool allSpread; | |
| int tries = 0, maxTries = 5000; | |
| float bumpDist = 1.5f; |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <p>Hello World</p> | |
| </body> | |
| </html> |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>JS Bin</title>w | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
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
| /* | |
| app = express() | |
| db = a mongodb with the collection "users" | |
| */ | |
| app.get('/user/:name', function (req, res) { | |
| db.users.find({name: req.params.name}, function (theRecordThatYouAskedFor) { | |
| res.render('mytemplatename', { myTemplateVariableThatHoldsUserInfo: theRecordThatYouAskedFor}) | |
| }); |
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
| ig.module( | |
| 'game.main' | |
| ).requires( | |
| 'impact.game' | |
| 'impact.font' | |
| ).defines -> | |
| MyGame = ig.Game.extend | |
| font: new ig.Font('media/04b03.font.png') | |
| init: -> | |
| # Initialize your game here; bind keys etc. |
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
| table.andys-table { | |
| thead tr { | |
| font-weight: bold; | |
| } | |
| tbody { | |
| tr { | |
| border-right: 1px solid #ddd; | |
| td:first-child { | |
| font-weight: bold; |
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
| class View | |
| class @Pieces | |
| @keys = ['floor', 'ceiling', 'side', 'front'] | |
| @floorPieces = document.getElementsByClassName('floor')[0].children | |
| @ceilingPieces = document.getElementsByClassName('ceiling')[0].children | |
| @sidePieces = document.getElementsByClassName('side')[0].children | |
| @frontPieces = document.getElementsByClassName('front')[0].children | |
| @allPieces = floor: @floorPieces, ceiling: @ceilingPieces, side: @sidePieces, front: @frontPieces | |
| class @Utils | |
| @hide = (e) -> e.style.display = 'none' |
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
| <!DOCTYPE html> | |
| <html ng-app> | |
| <head> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.min.js"></script> | |
| </head> | |
| <body> | |
| <script> | |
| var | |
| domString = '<div>{{1+2}}</div>', | |
| injector = angular.injector(['ng']), |
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
| # get container | |
| container = document.getElementById "container" | |
| # create renderer and add to container | |
| renderer = new THREE.WebGLRenderer | |
| renderer.setSize container.offsetWidth, container.offsetHeight | |
| container.appendChild renderer.domElement | |
| # create the scene and camera | |
| scene = new THREE.Scene |
NewerOlder