Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️
looking for job

hyrious hyrious

🏃‍♂️
looking for job
View GitHub Profile
View meaqua.css
.meaqua {
transition: background-image 1s ease;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' width='80' height='80'%3E%3Cpath stroke='%23283c5f' stroke-opacity='0.04' fill='transparent' d='M8 13.8 Q8.3 11.1 10.5 11.9 C13.1 13.3 11.1 18.3 6.7 16.7 Q2.1 14.9 5.8 9.6 C10.1 4.5 18.2 10.8 14.4 17M14 16m40 40M28 33.8 Q28.3 31.1 30.5 31.9 C33.1 33.3 31.1 38.3 26.7 36.7 Q22.1 34.9 25.8 29.6 C30.1 24.5 38.2 30.8 34.4 37'%3E%3C/path%3E%3C/svg%3E");
}
[data-theme=dark] .meaqua {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80' width='100' height='100'%3E%3Cpath fill='%23faf7d9' fill-opacity='0.03' d='M14 16H9v-2h5V9.87a4 4 0 1 1 2 0V14h5v2h-5v15.95A10 10 0 0 0 23.66 27l-3.46-2 8.2-2.2-2.9 5a12 12 0 0 1-21 0l-2.89-5 8.2 2.2-3.47 2A10 10 0 0 0 14 31.95V16zm40 40h-5v-2h5v-4.13a4 4 0 1 1 2 0V54h5v2h-5v15.95A10 10 0 0 0 63.66 67l-3.47-2 8.2-2.2-2.88 5a12 12 0 0 1-21.02 0l-2.88-5 8.2 2.2-3.47 2A10 10 0 0 0
View slice-able.py
import sys
from itertools import islice
from typing import Iterator, List, Any
class Slicable:
def __init__(self, a: Iterator):
self.a = a
def __getitem__(self, s: 'slice') -> List[Any]:
return list(islice(self.a, s.start, s.stop, s.step))
@hyrious
hyrious / extend-generator.js
Created Jul 20, 2020
Generator = Object.getPrototypeOf(function* () {})
View extend-generator.js
const Generator = Object.getPrototypeOf(function* () {});
Generator.prototype.takeWhile = function (pred) {
const result = [];
while (true) {
const a = this.next();
if (a.done || !pred(a.value)) break;
result.push(a.value);
}
return result;
};
View hdu1332.cpp
#include <set>
#include <map>
#include <iostream>
using namespace std;
int main() {
int s;
string n;
map<int, set<int>> lines = { { 0, { 2, 3, 5, 6, 7, 8, 9, 0 } },
{ 1, { 4, 5, 6, 8, 9, 0 } },
View unsetRemoveEmpty.js
const _ = require('lodash');
function unsetRemoveEmpty(obj, path) {
function recur(obj, path) {
if (_.isEmpty(obj) || _.isEmpty(path)) return obj;
const key = path.shift();
const value = recur(_.get(obj, key), path);
if (_.isEmpty(value)) _.unset(obj, key);
return obj;
}
View Rescue-Interrupt.ps1
function Rescue-Interrupt([ScriptBlock]$action = { "^C" }) {
try {
[Console]::TreatControlCAsInput = $true
while ($true) {
if ([Console]::KeyAvailable) {
$key = [Console]::ReadKey($true)
if ($key.Modifiers -band [ConsoleModifiers]::Control) {
if ($key.key -eq "C") {
break
@hyrious
hyrious / importmap.json
Last active Jul 13, 2020
不支持内部继续 require
View importmap.json
{
"axios": "https://cdn.jsdelivr.net/npm/axios/dist/axios.js",
"node-fetch": "https://cdn.jsdelivr.net/npm/node-fetch/lib/index.js",
"markdown-it": "https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.js",
"remarkable": "https://cdn.jsdelivr.net/npm/remarkable/dist/remarkable.js"
}
View diff.pug
doctype html
head
meta(charset='utf-8')
meta(name="viewport" content="width=device-width")
title diff
script(src='https://cdn.jsdelivr.net/gh/google/diff-match-patch@master/javascript/diff_match_patch.js')
style.
#app {
background-color: white;
color: black;
View view-source.js
// ==UserScript==
// @name 本地文件加高亮
// @namespace Violentmonkey Scripts
// @match file:///*
// @grant none
// @version 1.0
// @author hyrious
// @description 浏览器就是用来看代码的
// ==/UserScript==
void (function() {
View Go.sublime-build
{
"cmd": ["go", "run", "$file"],
"selector": "source.go",
"file_regex": "(.*?\\.go):(\\d+):(\\d+): (.*)",
}
You can’t perform that action at this time.