Skip to content

Instantly share code, notes, and snippets.

@EvanCarroll
EvanCarroll / discord-convo.txt
Last active July 19, 2023 18:34
Suspension message from hachyderm.io
Discord Conversation from network
====
[10:50 PM]Evan Carroll: I recently was suspended for this comment, I would like to know why?
Just so you know the origin story there: AFAIK Codidact came out of the Monica affair on StackExchange. Which was basically a conservative Jew that pulled a Jordan Peterson and claimed that a CoC that prevented her from harassing others with pronouns they found offensive was limiting her free speech. It came out of a desire not to be limited by a CoC. I can't go for that, but I'm glad the people that went there left! @effendiian@masto.nyc
The reason was this,
Your posts were reported for providing false information. After looking into it, we've decided to freeze your account. Please read on for additional information about why and how you can reverse this.
use v5.36;
use Sub::Util ();
use Inline::Python ();
use File::Slurp ();
use File::Spec ();
use Exporter 'import';
our @EXPORT = qw(convert);
use experimental "signatures";
let mut res = config
.connect(tokio_postgres::NoTls)
.await;
let (dbh, connection);
loop {
match res {
Err(_) => {
// 1. Must only say "ClientError::*" ONCE.
// 2. Must return Result<Vec<String>, ClientError::*>
// 3. No nesting blocks or nested closures
// 4. Can be no unwrap, or try macro
//use std::ops::Deref;
let services = document
.select("ul.info")
.ok()
.and_then( |mut select| select.nth(1) )
.as_ref()
// 1. Must only say "ClientError::*" ONCE.
// 2. Must return Result<usize, ClientError::IndexParseError>
// 3. No nesting blocks, according to RustFMT
// 4. Can be no unwrap, or try macro
//use std::ops::Deref;
let services = document
.select("ul.info")
.ok()
.and_then( |mut select| select.nth(1) )
.as_ref()
// 1. Must only say "ClientError::IndexParseError" ONCE.
// 2. Must return Result<usize, ClientError::IndexParseError>
// 3. No nesting blocks
let last_id = document.select("div.cart:nth-child(1)")
.ok()
.and_then(|mut x| x.next() )
.and_then(|x| {
x.attributes
.borrow()
.get("id")
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
CPU Family: 0x6
ecarroll=# explain SELECT j1.*, jsonb_typeof(j1.value) FROM jsonb_array_elements('[ 7,2, [6,7], 2,10 ]'::jsonb) AS j1 LEFT OUTER JOIN LATERAL jsonb_array_elements(j1."value") ON jsonb_typeof(j1.value) = 'array';
QUERY PLAN
-------------------------------------------------------------------------------------
Nested Loop Left Join (cost=0.01..251.25 rows=100 width=64)
Join Filter: (jsonb_typeof(j1.value) = 'array'::text)
-> Function Scan on jsonb_array_elements j1 (cost=0.00..1.00 rows=100 width=32)
-> Function Scan on jsonb_array_elements (cost=0.00..1.00 rows=100 width=0)
(4 rows)
@EvanCarroll
EvanCarroll / enjoy.c
Last active August 16, 2018 21:03
Why C is impossible to teach?
#include <stdio.h>
int a[2][2] = {{1,2},{3,4}};
int (*b)[2] = a;
int main () {
printf("%d\n", *b[1]);
printf("%d\n", (*b)[1]);
printf("%d\n", (*b+1)[1]);
printf("%d\n", (*(b+1))[1]);
@EvanCarroll
EvanCarroll / ch3.js
Created July 22, 2018 18:32
Closures
function f() {
let counter = 0;
return function () {
counter = counter + 1;
return function () { return counter }
}
}
Explain what the above code does and how we can use it.