Skip to content

Instantly share code, notes, and snippets.

View Greenheart's full-sized avatar
🌍
Let's co-create a future that is regenerative and distributive by design

Samuel Plumppu Greenheart

🌍
Let's co-create a future that is regenerative and distributive by design
View GitHub Profile
@Greenheart
Greenheart / workaround.md
Last active December 19, 2022 22:49
Fix react-native builds on case sensitive file systems by linking headers

A workaround is to add the following to the post_install step in ios/Podfile. This way it will be automatically applied when you reinstall dependencies.

# Link headers to fix build on case sensitive file systems
# This will only be executed on case sensitive file systems where "pods" doesn't resolve to "Pods"
unless File.exist? "pods"
  # For files, create a symlink with `ln -s`
  system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
  
  # For directories, create a symlink with `ln -sfh`
@Greenheart
Greenheart / plugin.js
Created December 12, 2022 22:56
Tailwind CSS 3 text-shadow plugin
// Credit to plugin solution and making it show up in editor intellisense:
// https://github.com/tailwindlabs/tailwindcss-intellisense/issues/227#issuecomment-1221083129
const plugin = require('tailwindcss/plugin')
const textShadowPlugin = plugin(({ addUtilities }) => {
addUtilities({
'.text-shadow': {
'text-shadow': '1px 1px 1px #0000003f',
},
const queue = [];
const execute = () => {
const action = queue[0];
if (action) {
action().finally(() => {
queue.shift();
execute();
});
}
};
@Greenheart
Greenheart / reverseParentheses.js
Created February 27, 2018 12:07
My solution to a challenge from https://codefights.com
/*
Samuel Plumppu - 2018-02-27
You have a string s that consists of English letters, punctuation marks, whitespace characters, and brackets. It is guaranteed that the parentheses in s form a regular bracket sequence.
Your task is to reverse the strings contained in each pair of matching parentheses, starting from the innermost pair. The results string should not contain any parentheses.
Example
For string s = "a(bc)de", the output should be
@Greenheart
Greenheart / curriculum.md
Last active May 14, 2020 23:45
FCC InfoSec Curriculum Outline

The Applied Information Security Curriculum

Sections & their challenges:

1. What is Security? Why is it Important?

1.1 Introduction to Security

  • Security is a fundamental topic when creating sustainable software.
  • Protect your users, your organization or even yourself in mainly two ways:
  1. Protect their personal data
@Greenheart
Greenheart / cache.py
Created December 9, 2015 09:16
A decorator that works as a simple cache
from math import sqrt
def cache(F):
"""A simple cache decorator"""
cache = dict()
def wrapper(*args):
try:
return cache[args]
except KeyError:
# Result not in cache --> Calculate and store it