Skip to content

Instantly share code, notes, and snippets.

View thomheymann's full-sized avatar

Thom Heymann thomheymann

View GitHub Profile
@thomheymann
thomheymann / App.tsx
Created December 13, 2023 11:46
State management discussion
import { useEffect, useState } from "react";
import "./styles.css";
export default function App() {
useEffect(
() => {
console.log("First of all, sync the URL (async operation)");
},
[
// May have deps
# `git clean` seems to ignore -e option when used with -X so had to replicated its behaviour using `git ls-files`
# only remove ignored files / folders
git clean -Xd # this works fine
git ls-files --directory --others --exclude-standard --ignored | xargs rm -rf # same as above
# only remove ignored files / folders but keep node_modules folder
git clean -Xd -e node_modules # exclude option is ignored
git ls-files --directory --others --exclude-standard --ignored | grep node_modules --invert-match | xargs rm -rf # this works fine
@thomheymann
thomheymann / function-declaration.js
Created October 5, 2015 16:50
Variable vs. function hoisting
// Both, function declaration and function body are hoisted to top of scope.
// Outside of scope, hence ReferenceError
console.log(foo); // ReferenceError: foo is not defined
(function () {
// Declaration and function body got hoisted to top of scope
console.log(foo); // [Function: foo]
console.log(foo()); // 'bar'
packages:
yum:
git: []
files:
/opt/elasticbeanstalk/hooks/appdeploy/pre/51install_meteor.sh:
mode: "000755"
user: root
group: root
encoding: plain
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@thomheymann
thomheymann / gist:3039567
Created July 3, 2012 12:53 — forked from tvandervossen/gist:1231476
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3