Skip to content

Instantly share code, notes, and snippets.

View Palleas's full-sized avatar

Romain Pouclet Palleas

View GitHub Profile
data class Person(val firstName: String, var age: Int) {
// ...
}
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
{
"name": "This is the name of the user",
"name": "Romain Pouclet",
"email": "This is the email of the user, blablabla doc",
"email": "[email protected]"
}
{
"name": "Skin Tone 0",
"swatches": [
{
"hue": 0.1041666666666669,
"saturation": 0.03225806451612903,
"brightness": 0.9725490196078431,
"alpha": 1,
"colorSpace": 0
},
% warning = "This file was automatically generated and should not be edited."
// ${warning}
%{
import glob
import os
import re
}%
struct FixtureFile {
import Foundation
import os.log
final class Searcher {
struct Result: Equatable {
let count: Int
let hasMore: Bool
}
import { message, warn, danger, markdown } from "danger"
export default async () => {
const issue = danger.github.issue;
console.log('Dealing with an issue here', { issue });
message("Hi!");
warn('Uh-oh, that is not good');
markdown('# This does not work, does it?');
}
// This is a generic filter
typealias Filter<T> = (T) -> Bool
// This is a simplified entry
struct Entry {
let title: String
}
// This is a tiny helper function that returns a filter
// that takes an entry and checks if the title starts with the
import Cocoa
precedencegroup ForwardApplication {
associativity: left
}
precedencegroup ForwardComposition {
associativity: left
higherThan: ForwardApplication
}
extension Sequence {
func groupBy<K: Hashable>(_ kp: KeyPath<Iterator.Element, K>) -> [K: [Iterator.Element]] {
// Creating the resulting dictionary
return reduce([:]) { grouped, item in
let key = item[keyPath: kp]
var copy = grouped
if copy[key] == nil {
copy[key] = []
}