Skip to content

Instantly share code, notes, and snippets.

@yhara
yhara / b.rs
Created February 1, 2019 10:42
struct Parser<'a> {
pub str: String,
pub current_token: Option<&'a str>,
}
impl<'a> Parser<'a> {
pub fn lex(&'a mut self) {
let tmp: &'a str = &self.str[0..1];
self.current_token = Some(tmp);
}
@yhara
yhara / b.rs
Created January 28, 2019 07:30
struct Parser<'a> {
pub str: String,
pub current_token: Option<&'a str>,
}
impl<'a> Parser<'a> {
pub fn lex(&mut self) {
self.current_token = Some(&self.str[0..1]);
}
}
This file has been truncated, but you can view the full file.
(function(undefined){var global_object=this,console;if(typeof global!=="undefined"){global_object=global}if(typeof window!=="undefined"){global_object=window}if(typeof global_object.console==="object"){console=global_object.console}else if(global_object.console==null){console=global_object.console={}}else{console={}}if(!("log"in console)){console.log=function(){}}if(!("warn"in console)){console.warn=console.log}if(typeof this.Opal!=="undefined"){console.warn("Opal already loaded. Loading twice can cause troubles, please fix your setup.");return this.Opal}var nil;var BasicObject;var _Object;var Module;var Class;function BasicObject_alloc(){}function Object_alloc(){}function Class_alloc(){}function Module_alloc(){}function NilClass_alloc(){}var Opal=this.Opal={};var BridgedClasses={};Opal.global=global_object;global_object.Opal=Opal;Opal.config={missing_require_severity:"error",unsupported_features_severity:"warning",enable_stack_trace:true};var $hasOwn=Object.hasOwnProperty;var $slice=Opal.slice=Array.prototyp

draftです。

footer: RubyKaigi 2017 (19, Sep) slidenumbers: true autoscale: true

Ruby, Opal and WebAssembly

RubyKaigi2017

inline

yhara (Yutaka Hara)


@yhara
yhara / keymap.c
Last active September 14, 2017 07:58
ergodox ez keymap 2017/09/14 (lets-split like)
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define LOWER 3
#define RAISE 4
@yhara
yhara / foo
Created September 2, 2017 06:52
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.
__DIR__
=> File.dirname(__FILE__)
File.dirname
__DIR__("../foo")
=> File.expand_path("../foo", File.dirname(__FILE__))
...............................
Finished in 17.36 seconds (files took 8.86 seconds to load)
31 examples, 0 failures
--- Called Methods ---
ActionView::LogSubscriber#initialize
ActionView::LogSubscriber.add_event_subscriber
ActionView::LogSubscriber.attach_to
ActionView::LogSubscriber.method_added
#
# 以下のコードを読み込むと、Brickクラスのメソッドが追加されます。
#
# LEDを光らせる
# @brick.set_led(色)
# 色は0〜9の数値
# 例: @brick.set_led(6)
#
# 音を鳴らす
# @brick.play_tone(音量, 周波数, 長さ)
extern i32 putchar(i32);
extern double sqrt(double);
def clamp(t: Float, min: Float, max: Float) -> Float
if t < min
min
elsif t > max
max
else
t