Skip to content

Instantly share code, notes, and snippets.

View damirka's full-sized avatar
There has to be an emoji for Capybara

Damir Shamanaev damirka

There has to be an emoji for Capybara
View GitHub Profile
@damirka
damirka / LANGUAGE-mdx-injection.json
Last active November 23, 2023 13:47
Add custom embedded syntax into .mdx
{
"fileTypes": [],
"injectionSelector": "L:source.mdx",
"patterns": [
{
"include": "#LANGUAGE-code-block"
}
],
"repository": {
"LANGUAGE-code-block": {
@damirka
damirka / we_work_on_the_kitchen.move
Created September 18, 2023 05:59
Code samples from the BH Singapore presentation.
#[allow(unused_variable, unused_field)]
module wework::cup {
/// A generic Cup from the manufacturer.
struct Cup has key, store {
id: UID,
filled: bool
}
/// Purchase a Cup from the manufacturer.
public fun purchase(coin: Coin<SUI>, ctx: &mut TxContext): Cup {
module sui::publisher {
use std::type_name;
use sui::object::{Self, UID};
use sui::tx_context::TxContext;
use sui::types;
use sui::bcs;
/// This type can only be created in the transaction that
/// generates a module, by consuming its one-time witness, so it
/// can be used to identify the address that published the package
@damirka
damirka / twitter.istanbul.workshop.move
Created November 26, 2022 13:59
Resulting application; twitter!
module twitter::twitter {
use sui::object::{Self, ID, UID};
use sui::tx_context::{Self, TxContext};
use std::ascii::{Self, String};
use sui::balance::{Self, Balance};
use sui::coin::{Self, Coin};
use sui::sui::SUI;
use sui::transfer;
/// The max length of a tweet
#[test_only]
module 0x0::tc_tests {
use sui::coin;
use sui::test_scenario::{Self as tc, next_tx, ctx};
struct TC_TESTS has drop {}
fun people(): (address) { (@0xABC) }
#[test]
@damirka
damirka / links_sui_move.md
Last active August 1, 2022 07:52
Sui Move samples for the presentation in Korea 01/08
@damirka
damirka / main.leo
Last active August 4, 2021 18:09
Leo Palindrome example
// This Program takes in any 20-byte low register string and tells
// whether a string is a palindrome ignoring any spaces.
function main(str: [char; 20]) -> bool {
return is_palindrome(str);
}
function is_palindrome(str: [char; 20]) -> bool {
const str_len = 20u32; // saving const for convinience

Wallpapers

Install with git git clone https://gist.github.com/85942af486eb79118467.git ~/Pictures/wallpapers

@damirka
damirka / zen.msg.sh
Last active December 5, 2019 14:16
Fancy GitHub Zen message on terminal start. Add this to your .bashrc or .bash_profile to receive inspiring message on every terminal start!
# Fancy Github message on terminal start (if network is up, otherwise nothing will happen)
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo;
/usr/bin/curl https://api.github.com/zen
echo; echo;
fi
@damirka
damirka / toHex.js
Created February 14, 2018 12:36
Luv it <3
function toHex(s) {
var hex = ‘’;
for (var i=0;i<s.length;i++) { hex += ‘’+s.charCodeAt(i).toString(16); }
return `0x${hex}`;
}