Skip to content

Instantly share code, notes, and snippets.

View hasparus's full-sized avatar

Piotr Monwid-Olechnowicz hasparus

View GitHub Profile
@hasparus
hasparus / datagovmetadata.json
Created February 25, 2017 16:48 — forked from max-mapper/datagovmetadata.json
EOP-GOV Metadata
{"help": "https://catalog.data.gov/api/3/action/help_show?name=package_search", "success": true, "result": {"count": 48, "sort": "views_recent desc", "facets": {}, "results": [{"license_title": "License not specified", "maintainer": "New Media", "relationships_as_object": [], "private": false, "maintainer_email": "newmedia@whitehouse.gov", "num_tags": 5, "id": "59694770-b6b6-4ae0-a4b9-4ae69c0be2f6", "metadata_created": "2016-07-02T10:06:26.199575", "metadata_modified": "2016-07-02T10:06:26.199575", "author": null, "author_email": null, "state": "active", "version": null, "creator_user_id": "47303a9e-1187-4290-85a3-1fc02dc49e4a", "type": "dataset", "resources": [{"cache_last_updated": null, "package_id": "59694770-b6b6-4ae0-a4b9-4ae69c0be2f6", "webstore_last_updated": null, "id": "3a8a0ad1-19e7-4153-bb2f-d70cf88aaaf8", "size": null, "state": "active", "hash": "", "description": "", "format": "CSV", "tracking_summary": {"total": 32, "recent": 1}, "last_modified": null, "url_type": null, "no_real_name": "True",
const cssPath = "/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.css";
const { readFile, writeFile } = require('fs');
readFile(cssPath, 'utf-8', (err, content) => {
if (err) throw err;
writeFile(
cssPath,
content.replace(
/\.editor-container{/g,
'.editor-container{-webkit-font-smoothing: antialiased;'
#requires -Version 2 -Modules posh-git
#based on tehrob from oh-my-posh
function Write-Theme
{
param(
[bool]
$lastCommandFailed,
[string]
$with
import GameLevel from './GameLevel';
export default {
component: GameLevel,
props: {
player: {
name: 'Arthas2000',
strength: 100,
},
enemy: {
import { ComponentClass, ComponentType, Ref } from 'react';
export type Fixture<T extends ComponentType<any>> = {
component: T;
init?: (arg: { compRef: Ref<T> }) => Promise<any>;
name?: string;
namespace?: string;
props: T extends ComponentType<infer X> ? X : never;
state?: T extends ComponentClass<any, infer S> ? S : never;
};
import React from 'react';
type Entity = {
name: string;
strength: number;
};
type Props = {
player: Entity;
enemy: Entity;
import { Fixture } from '../utils/Fixture';
import { GameLevelClass, GameLevelStateless } from './GameLevel';
const fixture1: Fixture<typeof GameLevelStateless> = {
component: GameLevelStateless,
namespace: 'GameLevel/typed',
props: {
player: {
name: 'Arthas2000',
@hasparus
hasparus / code.fish
Created September 13, 2018 21:37
Call VSCode from WSL fish shell.
set wslUserRegex "~|(\/mnt\/d\/wsl-userdir)"
set winUserPath "D:/wsl-userdir"
set wslCodePath "'/mnt/d/universal-tools/Microsoft VS Code/bin/code'"
function code
set arg (string replace --regex $wslUserRegex $winUserPath $argv[1])
eval $wslCodePath $arg
end
@hasparus
hasparus / AvitEmojiStatus.psm1
Last active September 15, 2018 22:02
AvitEmojiStatus -- my powershell theme
# thank you Aaron -- https://www.aaron-powell.com/posts/2018-01-30-the-happy-powershell-prompt/
# and you, Jan -- https://github.com/JanDeDobbeleer/oh-my-posh/blame/master/Themes/Avit.psm1
#requires -Version 2 -Modules posh-git
$happyPrompts = @('👻'; '🤖'; '🖖'; '❤️'; '🌷'; '🐸'; '🍺'; '😀'; '🤜'; '🎉'; '🤟'; '👌'; '🌈'; '🗿'; '💯'; '🌋'; '🌌';)
$angryPrompts = @('👿'; '👹'; '😭'; '🤢'; '💀'; '👺'; '🕵️'; '🤷‍'; '🖕'; '🔥'; '🌡️'; '🔪';)
function Write-Random {
param([string[]] $arr)
Write-Prompt -Object " $($arr[(Get-Random -min 0 -max ($arr.Length))]) " -ForegroundColor $sl.Colors.PromptForegroundColor
@hasparus
hasparus / code.fish.v2
Created October 5, 2018 10:00
Changed root from /mnt to /
set wslUserRegex "~|(\/d\/wsl-userdir)"
set winUserPath "D:/wsl-userdir"
set wslCodePath "'/d/universal-tools/Microsoft VS Code/bin/code'"
function code
set arg (string replace --regex $wslUserRegex $winUserPath $argv[1])
eval $wslCodePath $arg
end