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 KEY={ | |
| UP: 38, | |
| DOWN: 40, | |
| W: 87, | |
| S: 83, | |
| }; | |
| var pingpong = {}; | |
| pingpong.ball = { | |
| speed: 5, | |
| x: 150, |
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
| $(function(){ | |
| $("#add").click(function(){ | |
| var description=$("#description").val(); | |
| if(description === ""){ | |
| $("#alert").html("<strong>Warning</strong> You left the todo app!"); | |
| $("#alert").fadeIn().delay(1000).fadeOut(); | |
| return false; | |
| } | |
| $("#todos").prepend("<li><input type='checkbox' name='checkbox'>"+ description+ "</li>"); | |
| $("#form")[0].reset(); |
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
| <html> | |
| <head> | |
| <title>example javascript</title> | |
| </head> | |
| <body> | |
| <form name="logInForm" method="post" onsubmit="return validate()"> | |
| First name:<input type="text" id="firstName" name="firstName" > | |
| Last name:<input type="text" id="lastName" name="lastName" > | |
| <input type="submit" value="LogIn" id="logIn">////<---------this type comes in pair with onsubtmit attribute!!! | |
| <div id="error"></div> |
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
| $(document).ready(function(){ | |
| var allQuestions= []; | |
| var questionNumber = 0; | |
| var score = 0; | |
| var name=[]; | |
| allQuestions[0]={question:"What is 2 + 2?", | |
| choices:[0,2,3,4], | |
| correct:3 }; | |
| allQuestions[1]={question:"What is 2 * 2?", | |
| choices:[0,2,3,4], |
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
| <script> | |
| var myApp = angular.module('myApp', []); | |
| myApp.controller("myFirst", function($scope){ | |
| $scope.clock = new Date(); | |
| var updateClock = function(){ | |
| $scope.clock = new Date(); | |
| } | |
| setInterval(function(){ | |
| $scope.$apply(updateClock);}, 1000); | |
| updateClock(); |
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
| describe("calculator",function(){ | |
| var calc; | |
| beforeEach(function(){ | |
| calc = new Calculator(); | |
| }) | |
| describe("addition", function(){ | |
| it("should be able to add a sum", function(){ | |
| var result = calc.addition(5,3); | |
| expect(result).toBe(8); | |
| }); |
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 steve = { | |
| name: "Steve", | |
| }; | |
| var haeseong = { | |
| name: "haeseong", | |
| }; | |
| var protoRun = { | |
| run: function(name){ |
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
| def secure_token | |
| token_file = Rails.root.join(".secret") | |
| if File.exist?(token_file) | |
| File.read(token_file).chomp | |
| else | |
| token = SecureRandom.hex(64) | |
| File.write(token_file, token) | |
| token | |
| end | |
| 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
| pyg = 'ay' | |
| original = raw_input('Enter a word:') | |
| if len(original) > 0 and original.isalpha(): | |
| word = original.lower() | |
| first = word[0] | |
| new_word = word[1:] + first + pyg | |
| print new_word | |
| else: |
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
| storage = {} | |
| storage["first"]={} | |
| storage["middle"]={} | |
| storage["last"]={} | |
| me = "steve seung lim" | |
| storage["first"]["steve"] = me | |
| storage["middle"]["seung"] = me |