Skip to content

Instantly share code, notes, and snippets.

View david50407's full-sized avatar

Davy david50407

View GitHub Profile
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
}
# Definition for a binary tree node.
# class TreeNode
# attr_accessor :val, :left, :right
# def initialize(val = 0, left = nil, right = nil)
# @val = val
@david50407
david50407 / 00-README.md
Last active August 17, 2021 06:48
Open GitHub in VS Code Remote Repository without cloning repo

Open GitHub repo with VSCode Remote Repository

How to use

Configuration

export {}
declare global {
interface Object {
/**
* Yields this to the `interceptor`, and returns this.
* The primary purpose of this method is to "tap into" a method chain,
* in order to perform operations on intermediate results within the chain.
*
* @returns this
#!/usr/bin/env bash
set -euo pipefail
PATH=/bin:/sbin
http-request() {
local domain=$1; shift
local path=${1:-/}; shift
local verb=GET
(
#include <vector>
template<typename itor>
void func(itor x) {
typedef typename std::iterator_traits<itor>::value_type T;
T value = *x;
}
int main(void) {
std::vector<int> vec;
class AE < StandardError
attr_reader :foo, :bar
def initialize(a, b= nil)
@foo= a
@bar= b
end
end
begin
@david50407
david50407 / cahined.rb
Last active August 19, 2016 07:32
Make chained call possible when creating a block using `&`
class Chained
class DSL
undef_method *(Class.new.instance_methods - %i( __send__ __id__ object_id ))
def initialize
@chain = []
end
def method_missing(name, *args, &block)
@chain << [name, args, block]
import React from 'react'
import { Row, Col } from 'react-flexbox-grid'
import AppBar from 'material-ui/lib/app-bar'
import IconButton from 'material-ui/lib/icon-button'
import NavigationArrowBack from 'material-ui/lib/svg-icons/navigation/arrow-back'
import LoginForm from './components/LoginForm'
export default React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired,
ifdef windows
# already required "./winapi/kernel32.cr" in prelude
else
require "./dl/lib_dl.cr"
end
# This is a frontend wrapper,
# using LibDL or WinApi as backend.
module DL
ifdef windows
@david50407
david50407 / c_wrapper.cr
Last active November 12, 2015 20:16 — forked from jhass/lib_c.cr
Platform indepedent standard library for Crystal
ifdef linux
require "./linux_c_wrapper"
elsif windows
require "./windows_c_wrapper"
end
module CWrapper
ifdef linux
IMPL = OS::Linux::CWrapper
elsif windows