View string-to-list.lisp
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
(defun string-to-list (string) | |
(mapcar #'princ-to-string (coerce string 'list))) | |
;; (string-to-list "123🚘🚃🚅456") | |
;; > ("1" "2" "3" "🚘" "🚃" "🚅" "4" "5" "6") | |
;; and | |
(defun list-to-string (list) | |
(let ((result "")) |
View json_encode.php
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 _json_encode($ar) { | |
$res = ""; | |
if (is_array($ar)) { | |
if (count($ar)==0) { | |
return $res; | |
} | |
if (is_numeric(array_keys($ar)[0])) { | |
View s-expression.ts
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
export function parse(lisp: string) { | |
const lexer = /"[^"]*"|\(|\)|[^\s()]+/g; | |
const ts = lisp.match(lexer)!; | |
let i = 0 | |
const rec = () => { | |
let prg: any = undefined | |
while (i < ts.length) { | |
if (ts[i] === '(') { | |
if (!prg) { |
View init.el
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
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) | |
(package-initialize) | |
(add-to-list 'image-types 'svg) | |
(defvar bootstrap-version) | |
(let ((bootstrap-file | |
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) | |
(bootstrap-version 6)) |
View expect.ts
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 { spawn as expectSpawn } from 'node-pty'; | |
export async function expect(cmd: string, expectations: { expected: string, retort: string }[], dir?: string) { | |
let cmdSplit = cmd.split(' ') | |
const p = expectSpawn(cmdSplit.shift()!, cmdSplit, { cwd: dir }) | |
p.onData((data) => { | |
console.log(data) | |
const expected = expectations.shift() |
View index.html
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
<div id="gameDiv"></div> | |
<h1>Pong</h1> | |
<p>Move the left paddle with W, S</p> | |
<p>Move the right paddle with the arrow keys</p> |
View gp-init-osx.sh
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
#!/bin/bash | |
wget -O pgsql.zip "https://sbp.enterprisedb.com/getfile.jsp?fileid=1258319" | |
unzip -dpgsql_binaries pgsql.zip | |
rm pgsql.zip | |
cd pgsql_binaries | |
xattr -d com.apple.quarantine ./bin/* | |
xattr -d com.apple.quarantine ./lib/* | |
xattr -d com.apple.quarantine ./lib/postgresql/* | |
./bin/initdb -D ./pgdata -U postgres -W -E UTF8 -A scram-sha-256 |
View backets.js
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 getBrackets(str) { | |
// Initialize the stack to keep track of open braces | |
const stack = []; | |
// Initialize the result string | |
let result = ""; | |
// Iterate over each character in the input string | |
for (let i = 0; i < str.length; i++) { | |
const char = str[i]; |
View chat.js
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 React from 'react'; | |
import { useState } from 'react'; | |
import { makeStyles } from '@material-ui/core/styles'; | |
import Paper from '@material-ui/core/Paper'; | |
import Grid from '@material-ui/core/Grid'; | |
import Box from '@material-ui/core/Box'; | |
import Divider from '@material-ui/core/Divider'; | |
import TextField from '@material-ui/core/TextField'; | |
import Typography from '@material-ui/core/Typography'; | |
import List from '@material-ui/core/List'; |
View gist:95349907fe304c1ebc4bf4929b18d5c6
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
Line 1305 in wp-includes/pluggable.php you can find; | |
function wp_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { | |
that is probably what executes the redirect, so just add a | |
die($location); | |
to see if this is indeed the culprit. |
NewerOlder