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 Foobar(v) { | |
v(this.resolve.bind(this), this.error.bind(this)) | |
} | |
Foobar.prototype.resolve = function(v) { | |
this.value = v | |
this.resolveFunction(v) | |
} | |
Foobar.prototype.error = function(v) { |
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
func mergesort<T: Comparable>(_ input: [T] ) -> [T] { | |
guard input.count > 1 else { | |
return input | |
} | |
let midPoint:Int = input.count / 2 | |
let tempLeft = Array(input[..<midPoint]) | |
let tempRight = Array(input[midPoint...]) | |
let left = mergesort(tempLeft) |
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
ELF>p@`V@8 @*)@@@��888�2�2�<�L�L��<�L�L��TTTDDP�tdd2d2d2TTQ�tdR�td�<�L�L@@/lib64/ld-linux-x86-64.so.2GNUGNU���� ��˔x�2M�"') D ` z"� ��� | |
#)>DN |
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
const isPrime = (num) => { | |
switch(num) { | |
case 1: | |
return false | |
case 2: | |
return true | |
case 3: | |
return true | |
default: | |
break |
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 z_derangement. | |
*"---------------------------------------------------------------------- | |
*"*"Local Interface: | |
*" IMPORTING | |
*" VALUE(I_NUMBER) TYPE NUM | |
*" EXPORTING | |
*" VALUE(EX_NUMBER) TYPE ZBIG | |
*"---------------------------------------------------------------------- | |
ASSERT i_number > 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
#include "stdafx.h" | |
#include <vector> | |
#include <iterator> | |
#include <iostream> | |
using namespace std; | |
const double pi = 3.14159265358979; | |
class Circle { | |
public: | |
Circle(int rad) : radius(rad) { |
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 <vector> | |
#include <iterator> | |
#include <iostream> | |
using namespace std; | |
typedef vector<int>::iterator itr; | |
itr partition(itr, itr); |
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 <vector> | |
#include <iostream> | |
using namespace std; | |
int partition(vector<int>&, int, int); | |
void quicksort(vector<int>& tobeSorted, int lo, int hi) { | |
if (lo < hi) { |
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 brainLuck(code, input){ | |
var codeArray = code.split(""); | |
var memory = [0]; | |
var codePtr = 0; | |
var memPtr = 0; | |
var inputPtr = 0; | |
var output = []; | |
//debugger; | |
while(codePtr < codeArray.length) { | |
var value = memory[memPtr]; |
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
// Write some awesome Swift code, or import libraries like "Foundation", | |
// "Dispatch", or "Glibc" | |
func interpreter(code: String, iterations: Int, width: Int, height: Int) -> String { | |
guard width > 0 || height > 0 else { | |
return "" | |
} | |
//print("code: \(code), height: \(height), width:\(width), iterations: \(iterations)") | |
let validCommands : [Character] = ["n", "s", "e", "w", "*", "[", "]"] | |
var memory = Array(repeating: Array(repeating: 0, count: width), count: height) | |
var memX = 0, memY = 0 |
NewerOlder