Skip to content

Instantly share code, notes, and snippets.

View natterstefan's full-sized avatar
🟨
getting things done 💪🏻

Stefan Natter natterstefan

🟨
getting things done 💪🏻
View GitHub Profile
@przbadu
przbadu / react-on-docker.md
Last active December 16, 2023 13:44
Setup Docker for React development

STEP 2: setup docker to run react app (dev and production) configuration: https://gist.github.com/przbadu/929fc2b0d5d4cd78a5efe76d37f891b6

Setup Docker for React development

Because we are using Docker, we are not going to install node, npm, create-react-app in our development machine, not even for generating create-react-app scaffold.

For this purpose I am using 2-step docker configuration:

  • In first step, we will create a simple docker container, that does only one thing, install create-react-app
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@ncochard
ncochard / babel-webpack.md
Last active September 29, 2023 05:15
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
@CMCDragonkai
CMCDragonkai / bash_interactive_and_login.sh
Last active August 5, 2023 09:54
Bash & ZSH: Interactive and Login Shells
#!/usr/bin/env bash
[[ $- == *i* ]] && echo "This Bash Shell is Interactive Shell" || echo "This Bash Shell is Not a Interactive Shell"
shopt -q login_shell && echo "This Bash Shell is a Login Shell" || echo "This Bash Shell is Not a Login Shell"
@danielmconrad
danielmconrad / unifi-pi.md
Last active March 14, 2023 15:52
Installing Unifi Controller + Pi-hole on a Raspberry Pi

Installing Unifi Controller + Pi-hole

Update Packages

sudo rpi-update
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install vim -y
@d4rekanguok
d4rekanguok / webpack.config.js
Last active March 11, 2023 09:52
Config Storybook to avoid conflicts with SVGR
const path = require('path');
const pathToInlineSvg = path.resolve(__dirname, '../resources/icons');
module.exports = (_, _, defaultConfig) => {
const rules = defaultConfig.module.rules;
// modify storybook's file-loader rule to avoid conflicts with svgr
const fileLoaderRule = rules.find(rule => rule.test.test('.svg'));
fileLoaderRule.exclude = pathToInlineSvg;
@levelsio
levelsio / getRandomFollower.php
Created January 11, 2020 10:22
get random Twitter follower from your exported followers.js
<?
// str_replace removes the JS part and makes it into a normal JSON file
$followers=json_decode(str_replace('window.YTD.follower.part0 = ','',file_get_contents(__DIR__.'/followers.js')),true);
echo "\n\n";
echo number_format(count($followers)).' followers';
echo "\n\n";
@ottsch
ottsch / add_favicons.js
Last active July 16, 2022 17:56
Add favicon to links in Roam Research
new MutationObserver(() => {
let filtered = Array.prototype.filter.call(
document.querySelectorAll(".roam-body a"),
(a) => {
return a.hostname && !a.hostname.includes("roamresearch.com");
}
);
Array.prototype.forEach.call(filtered, (a) => {
if (a.text == "*") {
a.style.background = `url(https://www.google.com/s2/favicons?sz=16&domain=${a.hostname}) right center no-repeat`;
@blankg
blankg / WebViewBridge.js
Last active July 12, 2022 06:53
For RN >= 0.57 please look at https://github.com/blankg/rn-webview-bridge-sample-new/blob/master/resources/index.html. Provides a sample implementation for sending and receiving messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
/**
* Created by Guy Blank on 3/9/17.
*
* This is a sample provides an API to send & receive messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
* A sample project that uses the bridge is available here https://github.com/blankg/rn-webview-bridge-sample
*
* webViewBridge.send('functionToInvoke', {mydata: 'test'}, function(){console.log('success')},function(){console.log('error')});
*
* The API is designed to be similar to the Cordova exec API so migration to it should be almost seamless.
* The API also provides solution to a React-Native WebView bug in iOS which causes sending consecutive postMessage calls to override each other.
@ivanalejandro0
ivanalejandro0 / toggle-mic-mute.applescript
Created January 25, 2018 17:44
Toggle mic mute on OSX
-- Thanks to:
-- https://coolaj86.com/articles/how-to-control-os-x-system-volume-with-applescript/
-- https://robservatory.com/silently-mute-the-mic-input-via-applescript/
-- https://macscripter.net/viewtopic.php?id=16588
--
-- For integration with the system see: http://eddmann.com/posts/creating-a-mac-microphone-mute-keyboard-shortcut/
--
-- In order to keep the `storedInputLevel` value you need to use it compiled:
-- $ osacompile -o toggle-mic.scpt toggle-mic.applescript
-- And then run: