Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Swastik Baranwal Delta456

🎯
Focusing
View GitHub Profile
View veditor.v
import os
fn C.execvp(file charptr, argv &charptr) int
fn main() {
final_editor_cmd := os.file_name(os.args[0])[1..]
if os.args.len < 2 {
eprintln('Usage: `v$final_editor_cmd FILE:LINE: ...`')
exit(1)
}
View check_cast_type.v
pub fn (mut c Checker) can_type_cast(from table.Type, to table.Type) bool {
from_type_sym := c.table.get_type_symbol(from)
to_type_sym := c.table.get_type_symbol(to)
// check basic types
if c.check_types(from, to) {
return true
}
if to == table.bool_type || to_type_sym.kind == .none_ || from == table.none_type {
return false
}
@Delta456
Delta456 / print.v
Last active Jan 19, 2021
Python Print in V
View print.v
import os { flush }
struct Print {
sep string = ' '
end string = '\n'
}
fn (p Print) print(args ...string) {
for i, arg in args {
print(arg)
@Delta456
Delta456 / is_13.v
Last active May 4, 2020
is thirteen module in V
View is_13.v
module is_thirteen
import math
import time
import strings
const (
thirteen_strs = [
"xiii", // Roman numeral 13
"1.3", // Basically 13, see proof in https://github.com/jezen/is-thirteen/pull/420
@Delta456
Delta456 / link.txt
Created Apr 12, 2020
my golang link
View link.txt
@Delta456
Delta456 / mark.md
Created Jan 7, 2020
A href markdown for Mineswepper
View canvas.css
canvas { background: #eee; }