Skip to content

Instantly share code, notes, and snippets.

@slimsag
slimsag / ramblings.md
Last active December 13, 2023 08:02
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

@DavidWells
DavidWells / github-proxy-client.js
Last active March 15, 2024 08:28
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@pffigueiredo
pffigueiredo / useFetchStateMachine.ts
Last active April 27, 2021 10:20
Fetch reducer state machine with typescript support
import { Dispatch, Reducer, useReducer } from 'react';
type Nullable<T> = T | null | undefined;
type FetchMachineState<DataT, ErrorT> = {
status: 'idle' | 'loading' | 'success' | 'failure';
data: Nullable<DataT>;
error: Nullable<ErrorT>;
};
@m1m1s1ku
m1m1s1ku / grid.js
Created January 26, 2019 23:19
The grid polymer3
import * as Polymer from '@polymer/polymer';
import * as Settings from '@polymer/polymer/lib/utils/settings';
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
export default class TheGrid extends GestureEventListeners(Polymer.PolymerElement) {
static get is() { return 'the-grid'; }
static get template(){
return Polymer.html`
@ddevault
ddevault / Makefile
Last active February 20, 2024 14:17
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@m-abs
m-abs / main.ts
Last active September 6, 2018 14:33
Use async/await with NativeScript
// this import should be first in order to load some required settings (like globals and reflect-metadata)
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppModule } from "./app.module";
import './tslib.nativescript'; // <-- ADD THIS LINE
// A traditional NativeScript application starts by initializing global objects, setting up global CSS rules, creating, and navigating to the main page.
// Angular applications need to take care of their own initialization: modules, components, directives, routes, DI providers.
// A NativeScript Angular app needs to make both paradigms work together, so we provide a wrapper platform object, platformNativeScriptDynamic,
@EddyVerbruggen
EddyVerbruggen / label-max-lines.directive.ts
Last active November 22, 2023 06:13 — forked from m-abs/label-max-lines.directive.ts
Directive for NativeScript-angular, adding the property maxLines to Label
// Usage: <Label maxLines="3" .. />
import { Directive, ElementRef, Input, OnInit, OnChanges } from '@angular/core';
import { Label } from 'tns-core-modules/ui/label';
declare const android, NSLineBreakMode: any;
@Directive({
selector: 'Label[maxLines]',
})
@rob3c
rob3c / ngrx-remote-devtools-proxy-instructions.md
Last active June 12, 2024 09:17
Using @ngrx/store-devtools remotely with Ionic 2

Ok, I have on-device remote store debugging working with Ionic 2. Unfortunately, time-travel and state import doesn't work with store-devtools yet (see ngrx/store-devtools#33 and ngrx/store-devtools#31), but at least the Inspector, Log Monitor and Graph is working remotely. Here's how:

First, add https://github.com/zalmoxisus/remotedev to the project:

> npm install --save-dev remotedev

Then add these devtools proxy wrapper classes to the project. They provide the same interface as the browser extension so store-devtools will think it's just talking to the chrome extension. I left in the trace debug logging so you can clearly see what's happening in the console, but it's easy to remove if you want.

remote-devtools-proxy.ts

@othiym23
othiym23 / npm-upgrade-bleeding.sh
Created September 20, 2014 19:36
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
{{-- Define all our servers --}}
@servers(['staging' => '', 'production' => ''])
@setup
{{-- The timezone your servers run in --}}
$timezone = 'Europe/Amsterdam';
{{-- The base path where your deployments are sitting --}}
$path = '/var/www/site.com/htdocs';