Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env node
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title zxy-generate notion daily titles
// @raycast.mode fullOutput
// Optional parameters:
// @raycast.icon 🤖

{__/} ( • . •) / >❤️

@X140Yu
X140Yu / gulpfile.js
Created November 8, 2019 04:07
gulp + typescript + css + autorebuild
const gulp = require("gulp");
const sourcemaps = require("gulp-sourcemaps");
const ts = require("gulp-typescript");
const tsProject = ts.createProject("tsconfig.json");
const cssInput = "src/**/*.css";
const output = "out";
function typescript(cb) {
tsProject
@X140Yu
X140Yu / script.swift
Last active July 1, 2019 09:27 — forked from lexrus/auto-run.swift
每次执行 script.swift 都会检查是否需要重新编译,最后会执行编译后的 script.swiftc。
/*/../usr/bin/true
source="$0"
compiled="$0"c
if [[ "$source" -nt "$compiled" ]]; then
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcrun swiftc -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -g "$source" -o "$compiled" || exit
fi
"$compiled"
@X140Yu
X140Yu / bookmark.js
Created May 7, 2019 08:19
open current tab(github repo) in sourcegraph
javascript: (function() {
url = 'https://sourcegraph.com/' + location.href.replace(/(^\w+:|^)\/\//, '');
window.open(url, '__blank');
})();
@X140Yu
X140Yu / version.swift
Created November 29, 2018 07:25
compare string version in Swift
struct Version {
let rawValue: String
init(_ string: String) {
self.rawValue = string
}
enum CompareResult {
case greaterThan
case equal
@X140Yu
X140Yu / hdfs_client.rb
Created July 13, 2018 08:27
use hadoop hdfs in ruby
class HDFSClient
attr_accessor :prefix_url
def initialize(prefix_url)
prefix_url.append("/") unless prefix_url.end_with?("/")
@prefix_url = prefix_url
end
def upload(file_name, file_path)
system "curl -i -L -s -X PUT -T #{file_path} \
#{@prefix_url}#{file_name}\\?op\\=CREATE"
# 需要检查的 gem 以及对应的版本
requireGems = {
'psych' => '>= 2.1',
}
# cocoapods & psych
requireGems.each do |gem_name, gem_ver_reqs|
gdep = Gem::Dependency.new(gem_name, *gem_ver_reqs)
found_gspec = gdep.matching_specs.max_by(&:version)
if found_gspec
@X140Yu
X140Yu / cal.sh
Last active September 16, 2017 16:36
A shell script which helps you calculate a specific person's contribution
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Usage: $0 Author-Name"
exit 1
fi
echo Total Commit: $(git log --author=$1 --pretty=tformat: --oneline | wc -l)
git log --author=$1 --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "Added lines: %s, Removed lines: %s, Total lines: %s\n", add, subs, loc }'
@X140Yu
X140Yu / Monokai.style
Created April 11, 2017 01:49
A Monokai color theme for MWeb
editor
foreground: F5F5F5
background: 1B1E1C
caret: AF5F00
editor-selection
foreground: FFFFFF
background: 3E3E3E
H1