I hereby claim:
- I am asahasrabuddhe on github.
- I am ajitem (https://keybase.io/ajitem) on keybase.
- I have a public key ASCzLp0B_5dJy2k3unuvqHxUvIDzkguiOK6FYBttp-HGTQo
To claim this, I am signing this object:
Feature | Rust | Go | |
---|---|---|---|
Native support | Yes (PhantomData) | No (but generics simulate it) | |
Zero-cost abstraction | Yes | Yes | |
Compile-time enforcement | Strong | Strong (via type params) | |
Ergonomics | Cleaner syntax | Slightly hacky with _ T | |
Tooling support | Excellent | Improving |
Problem | Phantom Type Solution | |
---|---|---|
Writing to a read-only file | Only allow `Write(f File[Writable])` | |
Sending unverified request | Only allow `Send(r Request[Validated])` | |
Applying wrong permissions | Distinct phantom markers for each permission | |
Unsafe API transitions | Type-safe state machines (e.g. login flow) |
// This script injects an element at the top of the page. | |
// It doesn't work yet. To make it work, handle the TODO. | |
const button = { | |
name: 'Copy for Monday', | |
id: 'copyForMonday', | |
classList: [ | |
'flex-md-order-2', 'Button--secondary', 'Button--small', 'Button', 'm-0', 'mr-md-0' | |
], | |
onclick: () => { |
version: '3' | |
services: | |
user: | |
image: ajitemsahasrabuddhe/mirror:latest | |
ports: | |
- 9090:9090 | |
environment: | |
NAME: 'user-service' | |
labels: |
<?php | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ | |
/* Comment */ |
I hereby claim:
To claim this, I am signing this object:
package main | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/sha256" | |
"encoding/base64" | |
"encoding/hex" | |
"fmt" | |
) |
<?php | |
class MBM_Encrypt_Decrypt { | |
const ENCRYPT_METHOD = 'AES-256-CBC'; // type of encryption | |
const SECRET_KEY = 'rappier_simple_secret_key'; // secret key | |
const SECRET_IV = 'rappier_simple_secret_iv'; // secret iv | |
public function encrypt($string) { | |
return $this->encrypt_decrypt('encrypt', $string); | |
} |
git init --bare $HOME/.configs | |
alias config='/usr/bin/git --git-dir=$HOME/.configs/ --work-tree=$HOME' | |
config config --local status.showUntrackedFiles no | |
echo "alias config='/usr/bin/git --git-dir=$HOME/.configs/ --work-tree=$HOME'" >> $HOME/.zshrc |
[Trigger] | |
Type = Package | |
Operation = Install | |
Operation = Upgrade | |
Target = pacman-mirrorlist | |
[Action] | |
Description = Updating mirrorlist... | |
When = PostTransaction | |
Depends = reflector |