Skip to content

Instantly share code, notes, and snippets.

View thekarel's full-sized avatar

Charles Szilagyi thekarel

View GitHub Profile
@thekarel
thekarel / cropUnsplashImage.js
Last active March 5, 2020 15:12
Crop image on Unsplash bookmarklet. Popups need to be enabled for the site.
javascript:fetch(`https://unsplash.com/photos/${document.location.href.split('/').pop()}/download`).then(({url}) => window.open(`${url.split('?')[0]}?w=2048&h=1024&fit=crop`))
@thekarel
thekarel / README.md
Created February 14, 2020 07:04
Firebase Functions in Monorepo

The firebase.json should be in the root of the workspace and it only shows the relevant bits.

Put the webpack config into modules/firebase/

Before deploying the functions, build the function bundle with webpack (it will end up in dist/).

@thekarel
thekarel / graphql.ts
Created January 23, 2020 23:32
Apollo Server on Firebase Functions
import * as functions from 'firebase-functions'
import {ApolloServer, gql} from 'apollo-server-cloud-functions'
const typeDefs = gql`
type Query {
hello: String
}
`
const resolvers = {
@thekarel
thekarel / reindex.sh
Created September 8, 2019 21:01
Reindex media on Synology NAS
synoindex -R {all|photo|music|video|thumb}
@thekarel
thekarel / launch.json
Created September 7, 2019 17:43
Debug Cucumber tests
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Cucumber",
"program": "${workspaceRoot}/node_modules/.bin/cucumber-js",
"args": [],
"internalConsoleOptions": "openOnSessionStart",
@thekarel
thekarel / launch.json
Created September 2, 2019 14:37
Debug Jest test run in VSCode
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
https://play.google.com/store/ereview?docId=_ID_OF_APP_
@thekarel
thekarel / start.sh
Created August 20, 2019 14:17
Wait for Postgres from Docker
RETRIES=30
until docker exec -t $CONTAINERNAME psql -U postgres -c \\d > /dev/null || [ $RETRIES -eq 0 ]; do
echo "Waiting for postgres server, $((RETRIES--))..."
sleep 1
done
@thekarel
thekarel / push.sh
Created August 18, 2019 21:55
Send message with Pushbullet
curl https://api.pushbullet.com/v2/pushes -X POST -u <access token>: --header "Content-Type: application/json" --data-binary "{\"type\": \"note\", \"title\":\"Note Title\", \"body\": \"Note Body\"}"
@thekarel
thekarel / main.dart
Last active August 9, 2019 15:58
Flutter app starter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My App',
home: MyHomePage(),