-
Install VS Code extension: GitHub Repositories in VSCode before enabling this userscript.
-
press
,
(comma key) on GitHub to open code in VSCode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
PATH=/bin:/sbin | |
http-request() { | |
local domain=$1; shift | |
local path=${1:-/}; shift | |
local verb=GET | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AE < StandardError | |
attr_reader :foo, :bar | |
def initialize(a, b= nil) | |
@foo= a | |
@bar= b | |
end | |
end | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifdef linux | |
require "./linux_c_wrapper" | |
elsif windows | |
require "./windows_c_wrapper" | |
end | |
module CWrapper | |
ifdef linux | |
IMPL = OS::Linux::CWrapper | |
elsif windows |
NewerOlder