Skip to content

Instantly share code, notes, and snippets.

View LukasBombach's full-sized avatar
👨‍👩‍👧‍👦
Proud father

Lukas Bombach LukasBombach

👨‍👩‍👧‍👦
Proud father
View GitHub Profile
use tokio::{runtime::Builder, sync::{mpsc}};
use winit::{event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, window::{Window, WindowBuilder}};
pub struct Gpu {
pub surface: wgpu::Surface,
pub device: wgpu::Device,
pub queue: wgpu::Queue,
pub sc_desc: wgpu::SwapChainDescriptor,
pub swap_chain: wgpu::SwapChain,
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=>
// arrays
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])):
// components
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=>
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):(
// create notes
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props
@misaka
misaka / CategoriseTransactions.js
Last active March 19, 2023 13:04
JXA script to categorise transactions in Numbers.app
// JXA script to categorise selected rows of bank transactions in Numbers.app. Paste
// this script into ScriptEditor.app and run it there.
//
// See these for more info on using JXA:
//
// https://developer.apple.com/library/archive/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html
// https://www.macstories.net/tutorials/getting-started-with-javascript-for-automation-on-yosemite/
//
//
//
@DimitryDushkin
DimitryDushkin / react-shadow-dom-fix.js
Last active December 23, 2020 07:48
React v15 Shadow Dom events fix. Based on http://stackoverflow.com/a/37891448/297939. Unnecessery events removed and fix for multiple dispatches added.
export default function retargetEvents(el) {
// Here include necessary events' name to track
['onClick', 'onChange'].forEach(eventType => {
const transformedEventType = eventType.replace(/^on/, '').toLowerCase();
el.addEventListener(transformedEventType, event => {
for (let i in event.path) {
const item = event.path[i],
internalComponent = findReactInternal(item);
@bcherny
bcherny / react-rollup-typescript.md
Last active January 30, 2024 12:13
react + rollup + typescript boilerplate

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
@hassy
hassy / lambda.js
Last active September 19, 2022 17:20
Different behavior of context.succeed() vs callback() in AWS Lambda
//
// Lambda's timeout needs to be >5 seconds, 10 should do
//
var startedAt = new Date();
var interval = setInterval(function () {
console.log(startedAt, new Date());
}, 1000);
@mxstbr
mxstbr / webpack-for-node-modules.js
Last active February 13, 2021 20:28
How to use webpack to compile node modules
/* eslint-disable no-var */
var path = require('path');
var autoprefixer = require('autoprefixer');
const MATCH_ALL_NON_RELATIVE_IMPORTS = /^\w.*$/i;
module.exports = [{
output: {
filename: '[name].js',
library: 'atrium-react-plugin-beta',
@avdg
avdg / es6.ebnf
Last active September 15, 2023 06:04
ES6 bnf grammer - See https://avdg.github.io/es6.xhtml
/* ebnf file for es 6 - MAY CONTAIN ERRORS / DISAMBIGUITY */
Grammer::= Statement
/* Lexical grammer */
SourceCharacter ::= #x0000-#x10FFFF
InputElementDiv ::= WhiteSpace | LineTerminator | Comment | CommonToken | DivPunctuator | RightBracePunctuator
InputElementRegExp ::= WhiteSpace | LineTerminator | Comment | CommonToken | RightBracePunctuator | RegularExpressionLiteral
InputElementRegExpOrTemplateTail ::= WhiteSpace | LineTerminator | Comment | CommonToken | RegularExpressionLiteral | TemplateSubstitutionTail
InputElementTemplateTail ::= WhiteSpace | LineTerminator | Comment | CommonToken | DivPunctuator | TemplateSubstitutionTail
WhiteSpace ::= "<TAB>" | "<VT>" | "<FF>" | "<SP>" | "<NBSP>" | "<ZWNBSP>" | "<USP>"
@Restuta
Restuta / framework-sizes.md
Last active March 7, 2024 00:01
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@jhjguxin
jhjguxin / creating-nested-resources-in-ruby-on-rails-3-and-updating-scaffolding-links-and-redirection.markdown
Created July 9, 2012 03:32
Creating nested resources in ruby on rails 3 and updating scaffolding links and redirection