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
| odd_numbers = []; | |
| non_primes = []; | |
| i = 1 | |
| while i <= 10000: | |
| i = i + 2 | |
| odd_numbers.append(i) | |
| print len(odd_numbers) |
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
| from math import * | |
| odd_numbers = []; | |
| non_primes = []; | |
| limit = 8000 # needs to be 8000 to calculate 1000th prime | |
| i = 1 | |
| while i <= limit: | |
| i = i + 2 |
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
| // anonymous func to avoid polluting global namespace, and $ conflict | |
| (function($){ | |
| // throw error for undefined selectors | |
| var jQueryInit = $.fn.init; | |
| $.fn.init = function(selector, context, rootjQuery) { | |
| var result = new jQueryInit(selector, context, rootjQuery); | |
| if (result.length === 0) | |
| throw "jQuery cannot find the following selector: '" + selector + "'"; | |
| return result; |
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
| from math import * | |
| def calculate_n_primes(n): | |
| primes = [] | |
| prime_candidate = 1 | |
| global its_a_prime | |
| its_a_prime = True | |
| while len(primes) < (n + 1): |
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(){ | |
| var timeJq = $('span#time-js'); | |
| timeJq.countdown({ | |
| until: '+3h', | |
| layout:'{d<}{dn} {dl} and {d>}'+'{hn} {hl}, {mn} {ml} and {sn} {sl}' | |
| }); | |
| }); | |
| /* http://keith-wood.name/countdown.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
| var date = new Date(); | |
| var minutes = date.getMinutes(); | |
| if (minutes < 10) { | |
| minutes = "0" + minutes | |
| } | |
| date = date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' ' + date.getHours() + ':' + minutes; |
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
| $('#downloadify').downloadify({ | |
| data: function(){ | |
| var topRowCsv = "MiC " + $('.events-title-js').text() + ",From,To,Location" + "\n"; | |
| function removeNewLineChars(str) { | |
| return str.replace(/\r/g, "").replace(/\n/g, ""); | |
| } |
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
| " .vimrc Joe Egan 2009-07-27 2009-11-09 22:35:19 | |
| " BASIC | |
| set nocompatible " remove old vim commands | |
| set mouse=a " have the mouse enabled all the time: | |
| " allow backspacing over everything in insert mode | |
| set backspace=indent,eol,start | |
| set lbr | |
| set cursorline | |
| set laststatus=2 |
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
| Pbm.InfiniteScroll = {}; | |
| Pbm.InfiniteScroll.count = 0; | |
| Pbm.InfiniteScroll.init = function (url, liSelector) { | |
| var max = $.deparam.querystring(url).max; | |
| var endpoint = url.slice(0, url.indexOf('?')); | |
| function displaySpinner() { |
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 old = trigger.onclick; | |
| trigger.onclick = function() { | |
| if(old) old(); | |
| myFunc(); | |
| return false; | |
| }; |