Skip to content

Instantly share code, notes, and snippets.

View roelofjan-elsinga's full-sized avatar
Building fast applications

Roelof Jan Elsinga roelofjan-elsinga

Building fast applications
View GitHub Profile
@roelofjan-elsinga
roelofjan-elsinga / test.csv
Created January 26, 2022 14:33
Test CSV file
ID Titel Custom ranking Description
10001 Henk 1 Telt niet mee
10002 Henk 2 Telt niet mee
10003 Henk 3 Telt niet mee
10004 Henk 4 Telt niet mee
10005 Henk 5 Telt niet mee
10006 Henk 6 Telt niet mee
10007 Henk 7 Telt niet mee
10008 Henk 8 Telt niet mee
10009 Henk 9 Telt niet mee
@roelofjan-elsinga
roelofjan-elsinga / index.html
Created August 5, 2020 11:23
Include Service worker in your HTML
<script>
// Check that service workers are supported
if ('serviceWorker' in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js');
});
}
</script>
@roelofjan-elsinga
roelofjan-elsinga / webpack.mix.js
Last active June 17, 2022 19:44
Laravel Mix Workbox example
const mix = require('laravel-mix');
// Import the workbox plugin
require('laravel-mix-workbox');
mix
// ... js, scss, and other rules
// webpackConfig is important here
.webpackConfig({
@roelofjan-elsinga
roelofjan-elsinga / index.html
Created July 30, 2020 08:04
Load FB messenger widget on click
<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script defer>
function loadMessenger() {
window.fbAsyncInit = function() {
FB.init({
xfbml : true,
version : 'v7.0'
});
};
@roelofjan-elsinga
roelofjan-elsinga / main.yml
Created June 10, 2020 14:33
An Ansible example of a handlers file
- name: install_composer_deps
script: composer install --no-scripts --no-dev
- name: cache_laravel_config
script: "php artisan config:cache"
- name: clear_laravel_views
script: "php artisan view:clear"
- name: run_laravel_migrations
@roelofjan-elsinga
roelofjan-elsinga / playbook.yml
Created June 10, 2020 14:10
A sample Ansible playbook with roles deploy changes to a Laravel application
- hosts: roelofjanelsinga.com
vars_files:
- secrets.yml
vars:
github_repo_url: https://{{github_user}}:{{github_token}}@github.com/roelofjan-elsinga/portfolio.git
working_directory: /path/to/app
roles:
- deploy_laravel_app
@roelofjan-elsinga
roelofjan-elsinga / main.yml
Created June 10, 2020 14:09
An ansible role to pull changes from a repository
- name: "Pull changes from GitHub"
git:
repo: "{{github_repo_url}}", # This is how we can make this step reusable across projects
dest: "{{working_directory}}"
version: master # Branch to pull
accept_hostkey: yes
notify:
- install_composer_deps
- cache_laravel_config
- clear_laravel_views
@roelofjan-elsinga
roelofjan-elsinga / playbook.yml
Last active June 7, 2020 15:13
A sample Ansible playbook to deploy changes to a Laravel application
- hosts: roelofjanelsinga.com # You can also specify an IP address
vars_files:
- secrets.yml # Contains the github_user and github_token variable
vars: # Define new variables
github_repo_url: https://{{github_user}}:{{github_token}}@github.com/roelofjan-elsinga/portfolio.git
working_directory: /path/to/app
tasks:
- name: "Pull changes from GitHub"
git:
repo: "{{github_repo_url}}", # This is how we can make this step reusable across projects
@roelofjan-elsinga
roelofjan-elsinga / main.go
Last active May 13, 2020 11:22
A Go application to copy the contents of a source file to a target file
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
)
func main() {
@roelofjan-elsinga
roelofjan-elsinga / main.go
Created May 13, 2020 10:10
A Go application to print a custom string and number to the terminal
package main
import (
"flag"
"fmt"
"strconv"
)
func main() {
var message = flag.String(