Skip to content

Instantly share code, notes, and snippets.

View koenpunt's full-sized avatar
:octocat:
...

Koen Punt koenpunt

:octocat:
...
View GitHub Profile
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@UrsaDK
UrsaDK / Caching multi-stage builds in GA.md
Last active March 28, 2024 07:16
Speed up your multistage builds in GitHub Actions

Caching multi-stage builds in GitHub Actions

Caching Docker builds in GitHub Actions is an excellent article by @dtinth which analyses various strategies for speeding up builds in GitHub Actions. The upshot of the article is a fairly decisive conclusion that the best two ways to improve build times are:

  1. Build images via a standard docker build command, while using GitHub Packages' Docker registry as a cache = Longer initial build but fastest re-build times.

  2. Build your images via docker integrated BuildKit (DOCKER_BUILDKIT=1 docker build), while using a local registry and actions/cache to persist build caches = Fastest initial build but slightly longer re-build times.

The problem

#!/usr/bin/swift
/* Git commit hook. Place it into your .git/hooks folder with 'prepare-commit-msg' name
#!/bin/sh
echo "Start prepare-commit-msg hook"
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
#SHA1=$3
import Foundation
extension Character {
var isEmoji: Bool {
return unicodeScalars.allSatisfy { $0.properties.isEmoji }
}
}
func recentlyUsedEmoji() -> [Character]? {
#if os(iOS)
@douglashill
douglashill / main.m
Last active October 6, 2023 18:10
A minimal iOS 13 app that is set up in Objective-C rather than using a storyboard and UIApplicationSceneManifest
@import UIKit;
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
@end
@implementation SceneDelegate
@synthesize window = _window;
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
@AliSoftware
AliSoftware / Bindings.swift
Last active April 24, 2024 01:10
Re-implementation of @binding and @State (from SwiftUI) myself to better understand it
/*:
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI
The only purpose of this code is to implement those wrappers myself
just to understand how they work internally and why they are needed,
⚠️ This is not supposed to be a reference implementation nor cover all
subtleties of the real Binding and State types.
The only purpose of this playground is to show how re-implementing
them myself has helped me understand the whole thing better
@AngerM
AngerM / http.go
Created October 30, 2018 03:25
High Performance Golang HTTP Client
package utils
import (
"context"
"io"
"io/ioutil"
"net"
"net/http"
"strings"
"time"
@itsdouges
itsdouges / hoc-wrapping-component-with-default-props.tsx
Last active January 27, 2020 19:49
Passing default props info through a HOC using TypeScript 3.1.x
import * as React from 'react';
type Omit<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
type ExtractProps<TComponentOrTProps> = TComponentOrTProps extends React.ComponentType<
infer P
>
? P
: never;
interface InjectedProps {

Useful VSCode shortcuts

  • Navigate to a symbol in a file - ⌘O (add ":" to group by type)
  • Navigate to a symbol in a project - ⌘T (#)
  • Select line - ⌘I
  • Zen Mode - ⌘K+Z
  • Hide sidebar - ⌘B
  • Open markdown preview - ⌘K+V
  • Go to source file - ⌘ Click
  • Toggle terminal - ⌃`
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({