flowchart TD
A(Do you want to `malloc`?) -->| yes |Zig
A(Do you want to `malloc`?) -->| No |Rust
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
# this in your tmux config | |
bind M run-shell "source ~/.tmux/functions.sh && move_windows" | |
# this inside ~/.tmux/functions.sh | |
#!/bin/bash | |
# | |
function move_windows() { | |
windows=$( |
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
{ | |
"title": "swap numbers and shift+numbers", | |
"rules": [ | |
{ | |
"description": "swap numbers and shift+numbers", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "1", |
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
defmodule Fheads do | |
defp set_required(set, :built, :new), do: set | |
defp set_required(set, :built, :submit) do | |
type = get_field(set, :type) | |
assoc = get_field(set, type) | |
put_assoc(set, type, required: assoc.required) | |
end | |
# Re-usable outside of a changeset! :D |
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
defmodule CaseCondIf do | |
defp set_required(set) do | |
if !set.valid? do | |
set | |
else | |
state = get_field(set, :__meta__).state | |
IO.inspect(state) | |
stage = set.stage | |
# set_required(set, state, stage) | |
case {stage, state} do |
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
defmodule WordBase.Classifier.Value do | |
@kinds [ | |
%{string: "filter", atom: :Filter}, | |
%{string: "word", atom: :Word} | |
] | |
@types [ | |
%{string: "bool", atom: :Bool, db_type: :boolean}, | |
%{string: "text", atom: :Text, db_type: :string}, | |
%{string: "datetime", atom: :Datetime, db_type: :naive_datetime} | |
] |
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
# the join tables, many_to_many between: | |
# | |
# - categories_type(s) | |
# - filter | |
# | |
# - categories_type(s) | |
# - word | |
# | |
# type(s) refer to: bool, text, multi, datetime | |
# |
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
var nsp2 = io.of('/2'); | |
nsp2.on('connection', socket => { | |
socket.on('change color', (color) => { | |
nsp2.broadcast.emit('change color', color) | |
} | |
var nsp3 = io.of('/3'); | |
nsp3.on('connection', socket => { | |
socket.on('change color', (color) => { | |
nsp3.broadcast.emit('change color', color) |
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
# change application name here (executable output name) | |
TARGET=knapsack | |
# compiler | |
CC=gcc | |
# debug | |
DEBUG=-g | |
# optimisation | |
OPT=-O0 | |
# warnings |
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 | |
# Bash Menu Script Example | |
add_to_log() { | |
command echo $1>>log | |
} | |
crear(){ | |
echo "Nombre Usuario" | |
read namevar | |
echo "- Su respuesta: $namevar" |
NewerOlder