Skip to content

Instantly share code, notes, and snippets.

@syte
syte / test.ts
Last active December 12, 2015 00:51
code.ts
/// <reference path="../../../../Scripts/External/typings/react/react-global.d.ts"/>
/// <reference path="../../../../Scripts/External/typings/react/react.d.ts"/>
interface SearchViewModel {
Criteria: {
WhichPage: number;
ResultsPerPage: number;
TotalResults: number;
TotalPages: number;
Search?: string;
@syte
syte / for-snook.md
Created December 13, 2018 23:36 — forked from threepointone/for-snook.md
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21 ‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css in js is selectors.

The biggest win from cij is that computers generate selectors for you a

const isFunc = (func) => typeof func === 'function';
const validators = {
// Reference: https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript for email regex.
isEmail: (message, value) => {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(value)) ? null : message;
},
len: (len, message, value) => (value ? value.length : 0) <= len ? null : message ,
isRequired: (message, value) => !!value ? null : message
@syte
syte / sudoku.scala
Last active April 4, 2020 09:33
Sudoku Solver
/**
* Capable of solving any N * N sudoku puzzle in exponential time :P
*/
import scala.math.sqrt
type Board = Array[Array[Int]]
case class Cell(x: Int, y: Int, value: Int)
class Sudoku(var board: Board) {
def solve(): Boolean = {
@syte
syte / SMBDIS.ASM
Created July 21, 2025 01:07 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no