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
import MetagenomeDB as mdb | |
names = ['check1', 'check2', 'check3'] | |
def run(): | |
c = mdb.Collection.find_one({"name": "NL10_1002_vRNA:contigs-strict"}) | |
output=[] | |
for sequence in c.list_sequences(): | |
if (not "alignments" in sequence): | |
continue |
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
public partial class PageSettings : System.Web.UI.UserControl { | |
protected override void OnPreRender(EventArgs e) { | |
base.OnPreRender(e); | |
if (Page.IsPostBack && PageUtil.IsPageValidated() && Page.IsValid && | |
Page.Request.Params.Get(Page.postEventSourceID).Contains("cmdUpdate")) { | |
//cmdUpdate_click postback event occurred | |
var Tabs = new TabsController(); | |
Tabs.UpdateTabSetting(TabId, "MyNewSetting", MySetting.Text); | |
} |
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
//http://codereview.stackexchange.com/questions/13377/jquery-drawer-with-tab | |
/* | |
preference: rename jquery instance variables to start with $ | |
*/ | |
$(function () { | |
var $message = $('#message'), | |
$tab = $('#tab'), | |
$droid = $message.find('.droid'), | |
speed = 300; |
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
// Calendar | |
function calendar(d) { | |
$("#calendar").remove(); | |
$("#calendar_container").append("<table border='1' id='calendar'></table>"); | |
t = new Date(d); // Today [Wed Jan 16 2013 00:00:00 GMT-0500 (EST)] | |
var d = t.getDate(); // Today's date (1-31) [16] | |
var y = t.getFullYear(); // Full year [2013] | |
var m = t.getMonth(); // Month (0-11) [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 log2 = Math.log2; | |
if(!log2) { | |
log2 = function (x) { return Math.log(x) / Math.LN2; }; | |
} | |
function Ai() { | |
var score = function (grid, previous) { | |
var total = 0, count = 0, ptotal = 0, pcount = 0; | |
grid.eachCell(function (x, y, tile) { | |
if (tile) { total += (log2(tile.value)-1)*tile.value; count += 1; } |
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
/* | |
Implemented pseudocode available at | |
http://en.wikipedia.org/wiki/Mersenne_twister | |
as an asm.js module to learn about asm.js | |
*/ | |
function MersenneTwister(stdlib, foreign, heap) { | |
"use asm"; |
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
public static class Cache<T> { | |
static readonly ConcurrentDictionary<string, T> Dictionary = new ConcurrentDictionary<string, T>(); | |
//by making this a tuple with the generic constraint, there will be one per cache type; the first parameter will always be the default value | |
static readonly ConcurrentDictionary<string, Tuple<T, DateTime, TimeSpan>> Removals = new ConcurrentDictionary<string, Tuple<T, DateTime, TimeSpan>>(); | |
/// <summary> | |
/// Gets an item out of the cache or adds it if it does not already exist. | |
/// </summary> |
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
using System; | |
using System.Collections; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication11 { |
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
/* | |
output (cpu: i7 920) | |
Starting Benchmark | |
Running iteration: 1000/1000 | |
Running 1000000 sub-iterations - Time Taken: 00:00:00.0043953 | |
Running 1000000 sub-iterations - Time Taken: 00:00:00.0037585 | |
Test 1 | |
Average Time: 00:00:00.0043999 | |
Invalid Operations: 750007614 (75.001 %) |
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
using System; | |
using System.Collections; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; |
OlderNewer