Skip to content

Instantly share code, notes, and snippets.

View david50407's full-sized avatar

Davy david50407

View GitHub Profile
@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]
class AE < StandardError
attr_reader :foo, :bar
def initialize(a, b= nil)
@foo= a
@bar= b
end
end
begin
#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;
#!/usr/bin/env bash
set -euo pipefail
PATH=/bin:/sbin
http-request() {
local domain=$1; shift
local path=${1:-/}; shift
local verb=GET
(
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
@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

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