Skip to content

Instantly share code, notes, and snippets.

View leob's full-sized avatar

leob leob

View GitHub Profile
@GAS85
GAS85 / http2_apache2_ubuntu20.04.md
Last active April 19, 2024 18:11
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 20.04

Based on https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 20.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

Per default it will be apache2 version 2.4.41 what is enought for http2 support.

@EduVencovsky
EduVencovsky / Auth.jsx
Last active February 20, 2024 03:28
Private Routes with Auth using react-router and Context API
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { checkIsAuthenticated, authSignUp, authLogin, authLogout } from '../../services/auth'
export const AuthContext = React.createContext({})
export default function Auth({ children }) {
const [isAuthenticated, setIsAuthenticated] = useState(false)
const [isLoading, setIsLoading] = useState(true)
@tdlm
tdlm / how-i-work.md
Last active May 19, 2023 02:13
How I Work

When I Work

I am in the Pacific time zone (UTC -8/-7). Typically, I work from 9:00am - 6pm after waking up at about 5:30am, hopefully with a brief walk around the block, and getting the kids started with their day. I try to take a lunch anywhere between 11:30am and 2pm. Sometimes I'll step away for a short sanity break. Other than that, I'm usually at my desk. At the very least, I have my phone with me.

All that being said, I try my best to stay mindful, wherever I am. When I'm at work, my priority is work. When I'm with family, however, work becomes a close second.

Where I Work

I work from my home office in Anaheim Hills, California.

@aelkz
aelkz / index.scss
Created January 28, 2017 00:21
VueJS 2.0 scss configuration with: bulma.io + font-awesome
@charset "utf-8";
@import "./../../../node_modules/bulma/sass/utilities/all";
@import "./../../../node_modules/bulma/sass/base/all";
@import "./../../../node_modules/bulma/sass/elements/all";
@import "./../../../node_modules/bulma/sass/components/all";
@import "./../../../node_modules/bulma/sass/grid/all";
@import "./../../../node_modules/bulma/sass/layout/all";
$fa-font-path: './../../../node_modules/font-awesome/fonts/';
@hyamamoto
hyamamoto / string.hashcode.js
Created September 30, 2016 07:19
JavaScript Implementation of String.hashCode() .
/**
* Returns a hash code for a string.
* (Compatible to Java's String.hashCode())
*
* The hash code for a string object is computed as
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* using number arithmetic, where s[i] is the i th character
* of the given string, n is the length of the string,
* and ^ indicates exponentiation.
* (The hash value of the empty string is zero.)
@joecritch
joecritch / MyComponent.js
Last active September 29, 2021 15:16
Passing specific props in React / JSX
class MyComponent extends React.Component {
render() {
const {location, todos, users} = this.props;
//
// ... do things with your variables!
//
return (
<MyChild {...{location, todos, user}} />
// equivalent to:
// <MyChild location={location} todos={todos} user={user} />
@MatiMenich
MatiMenich / Upload Image Ionic.md
Last active December 1, 2017 18:49
This is a snippet for uploading images using the html5 file input on the device. This will capture the image selected in base64 format, so it can be easly uploaded to a backend.

Upload image using html5 on ionic

This is a snippet for uploading images using the html5 file input on the device. This will capture the image selected in base64 format, so it can be easly uploaded to a backend.

It should trigger something like this:

Image of Html5 image input

view.html

@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active March 6, 2023 00:10
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@petehouston
petehouston / sync.sh
Created February 19, 2015 06:52
Little script to sync the project/public/ and www/ directory for Laravel 5 deployment
#!/bin/sh
mv www/index.php index.php.saved
rm -rf www/*
# update project/ to your directory name
cp -a project/public/* www
cp project/public/.* www
rm -rf www/index.php
mv index.php.saved www/index.php
@taivo
taivo / ion-tabs-swipable.js
Created December 16, 2014 02:37
Swipe navigation for ion-tabs (for ionic framework v 1.0.0)
angular.module('yourModule')
.directive('tabsSwipable', ['$ionicGesture', function($ionicGesture){
//
// make ionTabs swipable. leftswipe -> nextTab, rightswipe -> prevTab
// Usage: just add this as an attribute in the ionTabs tag
// <ion-tabs tabs-swipable> ... </ion-tabs>
//
return {
restrict: 'A',
require: 'ionTabs',