Skip to content

Instantly share code, notes, and snippets.

View pieterclaerhout's full-sized avatar

Pieter Claerhout pieterclaerhout

View GitHub Profile
@Neophen
Neophen / Essential Full-Stack Elixir - Phoenix Boilerplate Guide.md
Created November 6, 2024 05:41
Essential Full-Stack Elixir/Phoenix Boilerplate Guide

Essential Full-Stack Elixir/Phoenix Boilerplate Guide

Core Features

1. Authentication & Authorization 🔐

Complete user authentication system including signup, signin, password management, and session handling.

Common Requirements:

  • User registration and login
  • Password reset/recovery
@larshei
larshei / LeafletMap.ex
Created September 19, 2023 19:58
Leaflet Map as Elixir Phoenix LiveView Component
defmodule Components.LeafletMap do
use Phoenix.Component
attr :class, :string, default: nil
def map(assigns) do
~H"""
<div style="overflow: hidden" phx-update="ignore" id="mapcontainer">
<div class={@class} phx-hook="Map" id="mapid"></div>
</div>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UnifiedBar</key>
<dict>
<key>DisclosureRequired</key>
<string>ace440ac-b4f6-4b43-aade-02bba1589aef</string>
<key>Enabled</key>
<false/>
@OzanKurt
OzanKurt / arr_dot.js
Created December 8, 2020 00:51
Laravel's Arr::dot function for Javascript.
/**
* Laravel's Arr::dot function for Javascript.
* IMPORTANT: Requires lodash installed.
*/
function dot(array, prepend) {
results = []
prepend = prepend || ''
$.each(array, function(key, value) {
if ((_.isObject(value) || _.isArray(value)) && ! _.isEmpty(value)) {
@steipete
steipete / URLCacheTest.swift
Last active August 21, 2024 11:18
Using URLCache with download tasks (NSURLCache & NSURLSessionDownloadTask)
import Foundation
import os.log
class URLCacheTest {
let logger = Logger(subsystem: "URLCacheTest", category: "main")
// HTTP HEADERS:
// Date: Wed, 04 Nov 2020 11:13:24 GMT
// Server: Apache
// Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
@ziadoz
ziadoz / Caddyfile
Created July 5, 2020 18:04
Laravel Caddy v2 Caddyfile
example.com {
root * /var/www/vhosts/example.com/public
php_fastcgi unix//var/run/php/php7.4-fpm.sock
file_server
encode zstd gzip
}
@ndaidong
ndaidong / install-go.sh
Last active June 1, 2021 21:34
Install Go on Endeavour, Debian, Fedora
#!/bin/bash
export GO_VERSION=1.16.3
export GO_DOWNLOAD_URL=https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz
export GOROOT=/opt/go
export GOPATH=$GOROOT/packages
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
sudo mkdir $GOROOT
@Inferis
Inferis / ViewController.swift
Last active December 1, 2019 23:27
Beginnings of a GCD wrapper in swift
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
@davisford
davisford / setup-avahi.sh
Created July 12, 2013 14:14
Setup avahi-daemon on Ubuntu for so you can reach hostname `ubuntu.local` from host OS
sudo apt-get install avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan
@justincase
justincase / gist:5469009
Created April 26, 2013 17:45
Print struct with field names and values. From http://blog.golang.org/2011/09/laws-of-reflection.html
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {