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
// ==UserScript== | |
// @name pixiv novel/comic anti-blackscreen | |
// @namespace https://gist.github.com/3172387 | |
// @description Removes the blackscreen that's shown when the viewer loses keyboard or mouse focus. | |
// @icon http://comic.pixiv.net/favicon.ico | |
// @match *://comic.pixiv.net/viewer/stories/* | |
// @match *://novel.pixiv.net/viewer/stories/* | |
// @version 4 | |
// @updateURL https://gist.github.com/raw/3172387/pixiv_novel_comic_nobs.js | |
// @grant none |
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 <iostream> | |
#include <chrono> | |
#include <thread> | |
#include <cmath> | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <xinput.h> |
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
# Search shell history with peco: https://github.com/peco/peco | |
# Adapted from: https://github.com/mooz/percol#zsh-history-search | |
if [ "$(which peco &>/dev/null && echo 'a' | peco --select-1)" = 'a' ]; then | |
function peco_select_history() { | |
local lbuf="$LBUFFER" | |
BUFFER= | |
zle -c -U "$(print -rl - $history | peco --layout=bottom-up --query "$lbuf")" | |
} | |
zle -N peco_select_history | |
bindkey '^R' peco_select_history |
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 $ from 'jquery' | |
// jQuery Deferreds don't have a prototype, so patching them is more complicated | |
// than the native Promises. | |
const origDeferred = $.Deferred | |
const sym = module.hot && module.hot.data | |
? module.hot.data | |
: Symbol('deferred-finally') |
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 | |
# | |
# Copyright (c) Microsoft Corporation. All rights reserved. | |
# Licensed under the MIT License. See License.txt in the project root for license information. | |
NAME="Code" | |
VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")" | |
ELECTRON="$VSCODE_PATH/$NAME.exe" | |
CLI="$VSCODE_PATH/resources/app/out/cli.js" | |
if [ "$OSTYPE" = "cygwin" ] && which cygpath &>/dev/null; then |
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 classNames from 'classnames' | |
// I am trying to write a React version of an internal library's component. | |
// They share the CSS and class names, so the internal library's jquery event handler will capture clicks, | |
// thus I have to use a ref and attach handlers directly to it. | |
class Test extends React.Component { | |
constructor (props) { | |
super(props) |
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
// Removes all files from outputPath that are not in webpack's output | |
// @this webpack | |
function cleanArtifacts () { | |
const result = new Set() | |
// globs to ignore when deleting | |
const cleanIgnore = [ '.gitignore' ] | |
this.plugin('done', () => { | |
if (result.size > 0) { | |
// eslint-disable-next-line no-console |
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
// having `entry: { main: path.resolve('src') }`: | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'common', | |
chunks: ['main'], | |
// "children" does not actually select all the children of "chunks", | |
// but completely ignores all "chunks" and selects the children of "name" | |
// instead, so it's useless for our use case, as we're making a new chunk. | |
minChunks: (() => { | |
const tag = `${__filename}-common-minChunks` | |
// the count argument will always be "1" as there's only one chunk in |
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
// // given | |
// | |
// import foo from "bar" | |
// export let a | |
// export { a as b } | |
// export function hoisted() {} | |
// export {readFile} from "fs" | |
// export * from "path" | |
// | |
// console.log(foo) |
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
using System; | |
using System.Collections.Generic; | |
using OpenTK; | |
using OpenTK.Graphics.OpenGL; | |
using OpenTK.Graphics; | |
using System.Drawing; | |
namespace GLTut | |
{ | |
public class Program : IDisposable |