Skip to content

Instantly share code, notes, and snippets.

View msyfls123's full-sized avatar
🕶️
Learn Cycle.js and Rust

Gnome Bard msyfls123

🕶️
Learn Cycle.js and Rust
  • Yuewen
  • Shanghai
  • 03:29 (UTC +08:00)
View GitHub Profile
/*
* This script fetches all color styles from a Figma team/document.
*
* Dependencies:
*
* - node-fetch
*
* Due to a limitation in the Figma /styles endpoint, we need to use a
* document for actually using the colors in a color grid 🙄That's why
* we're both fetching from /styles and /files below.
@hongyangqin
hongyangqin / new_gist_file.md
Last active March 11, 2021 08:05
震惊!原来命令行还可以这么玩?!

引言

你是否:

  • 好奇过命令行里那些花里胡哨的进度条是如何实现的?
  • 好奇过Spring Boot为什么能够打印五颜六色的日志?
  • 好奇过Python或者PHP等脚本语言的交互式命令行是如何实现的?
  • 好奇过Vim或者Emacs等在Terminal中的编辑器是怎么实现的?

如果你曾经好奇过,或者被这段话勾起了你的好奇心,那么你绝对不能错过这篇文章!

背景通过本文你可以学到:
@bampakoa
bampakoa / app-component.spec.ts
Last active September 30, 2020 07:19
Mock ipcRenderer with ngx-electron using RxJS Observables
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ElectronService } from 'ngx-electron';
import { AppComponent } from './app.component';
import { FakeElectronService } from './fake-electron.service';
describe('AppComponent', () => {
let fixture: ComponentFixture<AppComponent>;
let comp: AppComponent;
let electronService: FakeElectronService;
@MartinSeeler
MartinSeeler / konami-cheatcode-rx.js
Created October 2, 2015 10:39
Konami Cheat-Code with RxJs
var cheatCode = [38,38,40,40,37,39,37,39,66,65]; // Konami Cheat Code
Rx.Observable
.fromEvent(document, 'keydown')
.map(function(x) { return x.keyCode; })
.windowWithCount(cheatCode.length, 1)
.flatMap(function(xs) { return xs.toArray(); })
.do(function (x) { console.log(x); })
.filter(function(xs) { return _.isEqual(cheatCode, xs); })
.subscribe(function(x) { console.log('CHEATER!!11elf'); });
@alexdrone
alexdrone / block-action
Created May 8, 2012 12:21
block based target-action
// BlockInvocation.h
#import <Cocoa/Cocoa.h>
@interface BlockInvocation : NSObject {
void *block;
}
-(id)initWithBlock:(void *)aBlock;
@hagino3000
hagino3000 / client.js
Created December 8, 2011 18:42
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();