Skip to content

Instantly share code, notes, and snippets.

View TheThirdOne's full-sized avatar

Benjamin Landers TheThirdOne

  • Los Angeles, California
View GitHub Profile
app.get('/test', function(req, res) {
try{
fields.filter(function(name) {
if (thiz.restricted.indexOf(name) !== -1) {
throw "401";
}
query.where(name).equals(val);
});
}catch(e){
res.error(401, 'Field is restricted.');
link = document.createElement('a');
link.download = 'name.txt';
link.href = 'data:text/plain;base64,'+btoa('exmaple text\n here')
link.click()
  • horror / detective / socialization game
    • Main idea: Monsters can kill and replace people, you witness this occur once and have to use social interactions to deduce how many people are still human
    • Setting:
      • Small town: everyone knows everyone
    • Detials of monsters:
      • Very smart, it should be assumed that they know about everything you can do and will try to kill you as fast as possible as a result of you knowing that they are monsters. Howver, they are also patiant, they won't risk exposing themselves to get you.
      • Requirements to successfully kill:
        • Reasonable privacy, they wont be able to kill you safely if other people are watching
        • If you suspect them, they won't be able to kill you 1 on 1 easily (they aren't superhuman); you will be able to scream and call for help. In complete isolation you will die even if you suspect
  • If you don't suspect them, they can kill you instantly.
order = enum {greater, equal, lesser}
comparator<a> = (a,a)order
@assert pure, terminates
fn sorted<a>(pair (List<a>,comparator<a>))bool {
(l, cmp) = pair
if l.length() <= 1 {
return true
}
return cmp(l[0],l[1]) != order.greater & sorted(l.tail())
function h(arr, N){
let sum = 0;
// the special bounds checks don't include edges
for(let i = 2; i <= N-1; i++){
for(let k = 1; k < i; k++){
// if there is not a neighboring zero
if(![l(i-1,k),l(i+1,k),l(i-1,k-1),l(i+1,k+1),l(i,k-1),l(i,k+1)].map(j=>arr[j]).reduce((acc,z)=>acc||z===0,false)){
sum += arr[l(i,k)];
}
}
@TheThirdOne
TheThirdOne / exists.js
Created December 28, 2017 02:10
Higher order function practice
function Exists(fn, range){
return function(item){
for(var i of range){
if(fn(i)(item))return true;
}
return false;
};
}
function Some(fn,ranges){
@TheThirdOne
TheThirdOne / anotherlemma.txt
Last active February 16, 2018 01:16
Fuck this proof
"1. ((~C->((~C->~C)->~C))->((~C->(~C->~C))->(~C->~C))) Axiom (A2)
2. (~C->((~C->~C)->~C)) Axiom (A1)
3. ((~C->(~C->~C))->(~C->~C)) Modus Ponens: 2, 1
4. (~C->(~C->~C)) Axiom (A1)
5. (~C->~C) Modus Ponens: 4, 3
6. (~C->(C->~C))
function Bus(){
var valueQueue = [];
var promiseQueue = [];
return {
send:function(val){
if(promiseQueue.length != 0){
var toResolve = promiseQueue.shift();
toResolve(val);
} else {
valueQueue.push(val);
sub escaped_split {
my ($line) = @_;
# Free up three characters for temporary replacement
$line =~ s/%/%%/g;
$line =~ s/#/##/g;
$line =~ s/\?/\?\?/g;
# replace escaped \'s
$line =~ s/\\\\/%#\?/g;