Skip to content

Instantly share code, notes, and snippets.

@jcppman
jcppman / .vimrc
Last active October 18, 2019 06:52
My .vimrc
if $SHELL =~ "bin/fish"
set shell=/bin/bash
endif
set nocompatible
filetype off
set rtp+=~/.config/nvim/bundle/Vundle.vim
@jcppman
jcppman / Larva.js
Created April 11, 2014 07:00
Weekly EM
Larva.prototype.spawn = function larvaSpawn (addArgs) {
/*
* Some initialization, and arguments type checking,
* deleted for the 50 lines rule!
*/
process.nextTick(function () {
var child = spawn(command, args, {
env: env
@jcppman
jcppman / Supplementary.markdown
Last active August 29, 2015 14:03
IMP字幕组布告栏

###硬规则

  • 人名、公司名保留原文 (课程大量出现“Shure”,让人非常想翻译成“舒尔”,请忍住 Orz)
  • 如果出现年代 (本课程出现年代的几率应该不高),保留后两位 + ,如果是1960s这种,直接翻xx年代,如:
    • 1983年 => 83年
    • 1959 => 59年
    • 1980s => 80年代
  • 出现缩写时,视频中第一次__出现时在括号里标注__中文,之后一律用英文缩写就ok,如:
    • DAW => 第一次: DAW (数字音频工作站) 尔后: DAW
  • 在Google Docs里编辑时,每一轴的格式都是一行轴编号、一行时间轴、一行到几行的英文,译文/校对意见等被添加到英文后面后__确保中文与下一行时间轴中间有一行空行__
  • 校对不使用Google Docs的建议功能,直接把你的建议或者修改后的译文添加在原译文下一行,并设为红色
#!/usr/local/bin/fish
function tips
set_color red
echo $argv[1]
set_color normal
end
set SOURCE $argv[1]
set TARGET $argv[2]
@jcppman
jcppman / diffconflicts
Last active August 29, 2015 14:10
a better vimdiff for git
#!/bin/bash
# A better vimdiff mergetool for Git
#
# Git does a great job resolving merge conflicts automatically but there are
# times when human intervention is still needed. Git resolves all the conflicts
# that it is able to and finally wraps each conflict it cannot resolve within
# special markers which must be resolved by a human.
#
# The vertical format and lack of syntax highlighting in the plain conflict
# marker layout makes it difficult to spot subtle conflicts such as
@jcppman
jcppman / executor.js
Created April 15, 2015 06:06
mu-emitter exercise
define([ "./config", "when/when" ], function (config, when) {
"use strict";
var UNDEFINED;
var CALLBACK = config.callback;
var SCOPE = config.scope;
var HEAD = config.head;
var NEXT = config.next;
@jcppman
jcppman / ES2015Export.js
Last active September 2, 2017 04:10
KT Quiz Codes
// Option 1
export { myFunc as getMe }
// Option 2
export const muffler = { HOLY: 'GRAIL' };
// Option 3
export default {
muffler: muffler,
gangster: 'Zup!',
@jcppman
jcppman / TodoList.jsx
Last active December 3, 2022 02:41
Example
import { Component } from 'react';
import { withState, compose } from 'recompose';
import withTodos from './withTodos';
// let's assume these components exist
import TodoItem from './components/TodoItem';
import AddButton from './components/AddButton';
import InputBox from './components/InputBox';
// if in the future we need it elsewhere, maybe promote it to a global state
@jcppman
jcppman / Parent.vue
Last active November 18, 2021 16:26
Repro of volar issue #704
<script lang="ts">
import { defineComponent } from 'vue';
import SubComponent from './Sub.vue';
export default defineComponent({
components: {
SubComponent,
},
setup() {
function handleChange(n: number) {
(function(factory) {
typeof define === "function" && define.amd ? define(factory) : factory();
})(function() {
"use strict";
function makeMap(str, expectsLowerCase) {
const map = /* @__PURE__ */ Object.create(null);
const list = str.split(",");
for (let i = 0; i < list.length; i++) {
map[list[i]] = true;
}