test
d3.unconf example gist. Fork it here.
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
(function(){ | |
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; | |
// The base Class implementation (does nothing) | |
this.Class = function(){}; | |
// Create a new Class that inherits from this class | |
Class.extend = function(prop) { | |
var _super = this.prototype; | |
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
//Normal | |
function fibonacci(number) { | |
if (number > -1) { | |
var arr = []; | |
for (var i=0; i<=number; i++){ | |
if (i==0){ | |
arr.push(0); |
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
var array = [4, 1, 8, 9, 2, 5, 7, 0, 6, 3]; | |
function bubbleSort( a ) { | |
var swapped; | |
var support; | |
var i; | |
var n = a.length - 1; | |
do { | |
swapped = false; |
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
var arr = [ 1 , 2 , 3 , 4 , 5 ]; | |
function shuffle( arr ) { | |
var inputArr = arr; | |
var shuffledArr = []; | |
var loops = inputArr.length; | |
var randomNumber; | |
for ( var i = 0; i < loops; i++ ) { | |
randomNumber = Math.floor( Math.random() * ( loops - i ) ); |
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
class String | |
def reverseString | |
(self.length / 2).times {|i| self[i], self[-i-1] = self[-i-1], self[i]} | |
self | |
end | |
end | |
puts 'fede'.reverseString |
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
function fizzbuzz(n) { | |
var n; | |
var iterations = n; | |
var result = []; | |
for (n = 1; n <= iterations; n++) { | |
if ((n % 3 == 0) && (n % 5 == 0)) { | |
result.push('FizzBuzz'); |
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
function checkPalindrome(word) { | |
var arrayStart = word.split(''); | |
var arrayRev = []; | |
for (i = arrayStart.length-1; i >=0; i--){ | |
arrayRev.push(arrayStart[i]); | |
}; | |
if (arrayStart.length > 1) { | |
return arrayStart.join('') == arrayRev.join('') |
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
function firstNotRepeatedChar(str) { | |
var arr = str.split(''); | |
var result = ''; | |
var count = 0; | |
for (var i = 0; i < arr.length; i++) { | |
count = 0; | |
for (var y = 0; y < arr.length; y++) { | |
if (arr[i] == arr[y]) { |
OlderNewer