A Pen by David Fox-Powell on CodePen.
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
| // Loop Version | |
| function loopFib(n){ | |
| var first = 0; | |
| var second = 1; | |
| var sum; | |
| for(var i = 2; i <= n; i++){ | |
| sum = first + second; | |
| first = second; | |
| second = sum; | |
| } |
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 FibSequence | |
| def initialize | |
| @first = 0 | |
| @second = 1 | |
| end | |
| def find_fib(n) | |
| i = 2 | |
| print @first.to_s + " " | |
| print @second.to_s + " " |
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
| module = angular.module 'draggable', [] | |
| module.controller "dragDropCtrl", ($scope) -> | |
| $scope.dropPosition = null | |
| module.directive 'pixbiDraggable', ($timeout) -> | |
| restrict: 'A' | |
| controller: 'dragDropCtrl' | |
| scope: { | |
| dropPosition: "=" |
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
| puts "Enter the pyramid height" | |
| input = gets.chomp.to_i | |
| while input < 1 || input > 69 | |
| puts "Please enter a number between 1 and 69" | |
| input = gets.chomp.to_i | |
| end | |
| puts "Your input is #{input}" |
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 Car | |
| def initialize(name) | |
| @name = name | |
| end | |
| def name | |
| @name | |
| end |
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
| module.exports = function(grunt) { | |
| // Project configuration. | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| files: { | |
| desktopSrc: ['public/js/config/*.js', 'public/js/factories/*.js', 'public/js/controllers/*.js', 'public/js/directives/*.js'], | |
| mobileSrc: ['public_mobile/js/config/*.js', 'public_mobile/js/factories/*.js', 'public_mobile/js/controllers/*.js', 'public_mobile/js/directives/*.js'], | |
| desktopImg: ['public/images/{,**/}*.{jpg,png,gif}', 'public/video/**/{,**/}*.{jpg,png,gif}'], |
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
| // Lexical | |
| (function(){ | |
| function addIt(){ | |
| var x = 100; | |
| function addInside(){ | |
| return x += 5; | |
| } | |
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
| //http://www.crockford.com/javascript/little.html | |
| var singleton = (function(){ | |
| var privateHello = "hello"; | |
| function privateFunction(something){ | |
| privateHello = privateHello + " " + something; | |
| } | |
| return { | |
| changeSomething: function(a){ | |
| privateFunction(a); |
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
| .sharer-message-container { | |
| // finished state when visible | |
| position: absolute; | |
| top: 0%; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background: rgba(0, 0, 0, 0.9); | |
| z-index: 100; | |
| padding: 20px 10px; |
OlderNewer