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 { goget } from "../_util/util.ts"; | |
const allPatterns: string[] = goget("input.txt")[0].split(", ").sort(( | |
a, | |
b, | |
) => a.length - b.length); | |
const designs: string[] = goget("input2.txt"); | |
let possibleDesigns = 0; | |
let patterns: string[] = []; | |
const cache = {}; |
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 r from "npm:raylib"; | |
import { goget } from "../_util/util.ts"; | |
const bytes: number[][] = goget("input.txt").map((line) => { | |
//const bytes: number[][] = goget('testinput.txt').map((line) => { | |
const str = line.split(","); | |
return [parseInt(str[0]), parseInt(str[1])]; | |
}); | |
const VISUAL = false; |
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 ins = [2, 4, 1, 7, 7, 5, 1, 7, 4, 6, 0, 3, 5, 5, 3, 0]; | |
// const ins = [0, 3, 5, 4, 3, 0]; | |
const insLength = ins.length; | |
function doit(initialA: number = -1, compare: boolean = false) { | |
const output = []; | |
const ops = [ | |
// ADV | |
(operand: number) => { |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func main() { | |
fs := http.FileServer(http.Dir("./")) |
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 Cocoa | |
let context = CIContext() | |
let lidimg = NSImage(named: "lid")?.cgImage(forProposedRect: nil, context: nil, hints: nil) | |
let originalCIImage = CIImage(cgImage: lidimg!) | |
func perspFilter(_ input: CIImage) -> CIImage? |
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
// <input type="text" id="iban"> | |
document.getElementById('iban').addEventListener('input', function (e) { | |
var target = e.target, position = target.selectionEnd, length = target.value.length; | |
target.value = target.value.replace(/[^\dA-Za-z]/g, '').replace(/(.{4})/g, '$1 ').trim(); | |
if(e.inputType === 'deleteContentForward') { | |
target.selectionEnd = position += ((target.value.charAt(position) === ' ') ? 1 : 0); | |
} else { | |
target.selectionEnd = position += ((target.value.charAt(position - 1) === ' ' && target.value.charAt(length - 1) === ' ' && length !== target.value.length) ? 1 : 0); | |
if(target.selectionEnd % 5 === 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
<html> | |
<head> | |
<title>Browser-History Push/Pop</title> | |
</head> | |
<body> | |
<form id="myform"> | |
<label> |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
type Fleet struct { | |
Cars []Car | |
Countries []string |
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
'use strict'; // avoid ambiguity and sloppy errors | |
/** | |
* Tests whether or not a given string is a Palindrome | |
* @param {string} stringToTest - the string to test. | |
*/ | |
function isPalindrome(stringToTest) { | |
var start = 0, | |
end; |
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
UIGraphicsBeginImageContextWithOptions(myView.bounds.size, true, 0) | |
myUiView.drawViewHierarchyInRect(myView.bounds, afterScreenUpdates: true) | |
let myImage = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil) |
NewerOlder