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
let insert (a: array<int>) i item = | |
let mutable i = i - 1 | |
while i >= 0 && item < a.[i] do | |
a.[i + 1] <- a.[i] | |
i <- i - 1 | |
a.[i + 1] <- item | |
let isort (a: array<int>) = | |
let a = Array.copy a | |
for i in 1 .. (a.Length - 1) do |
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
ordered :: Int -> Int -> (Int, Int) | |
ordered x y | |
| x >= y = (x, y) | |
| otherwise = (y, x) | |
sumAndProduct :: Int -> Int -> (Int, Int) | |
sumAndProduct x y = (x + y, x * y) | |
shift :: ((Int, Int), Int) -> (Int, (Int, Int)) | |
shift ((x, y), z) = (x, (y, z)) |
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
#include "stdafx.h" | |
#include "HistoryContainer.h" | |
using namespace std; | |
void HistoryContainer::AddItem(string item) | |
{ | |
history.push_back(item); | |
} |
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
#include "stdafx.h" | |
#include <iostream> | |
#include <string> | |
#include <regex> | |
#include <fstream> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <conio.h> | |
using namespace std; |
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
#include "stdafx.h" | |
#include <iostream> | |
#include <string> | |
#include <regex> | |
#include <fstream> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <conio.h> | |
using namespace std; |
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
// rankclass.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
using namespace std; | |
class Ranker | |
{ |
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 tmpl(template, arr) { | |
if (template.constructor !== String) { | |
throw "Template must be a string!"; | |
} | |
for (var i = 0; i < arr.length; i++) { | |
template = template.replace("%{" + i + "}%", arr[i]); | |
} | |
return $(template)[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
function getScript(url) { | |
var xml = new XMLHttpRequest(); | |
xml.onreadystatechange = function () { | |
if (xml.readyState === 4 && xml.status === 200) { | |
eval(xml.responseText); | |
console.log("Evaluated the Javascript."); | |
} | |
} | |
xml.open("GET", url, true); | |
xml.send(); |
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
>>> User = new Class(); | |
>>> User.addInstanceFunc("isUser", function(){console.log("Yeppers!")}) | |
>>> userOne = new User(); | |
>>> userOne.isUser(); | |
Yeppers! | |
>>> User.addClassFunc("allUsers", function(){console.log("Just that guy...")}) | |
>>> User.allUsers(); | |
Just that guy... | |
>>> Parent = new Class(); | |
>>> Parent.addInstanceFunc("noActualUse",function(){console.log("This has no use!")}); |
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
/** | |
* @author Solomon Wise | |
*/ | |
"use strict"; | |
var domTools = {}; | |
domTools.searchInElements = function (elem, pattern) { | |
if (pattern.constructor !== RegExp) { | |
throw "Pattern must be a RegExp"; | |
} | |
if (elem.constructor !== String) { |
NewerOlder