Skip to content

Instantly share code, notes, and snippets.

@don1138
don1138 / set-percentage-width.swift
Last active May 20, 2023 15:08
Use percentage widths on SwiftUI layout objects
// Get screen width and subtract Safe Area margins
var containerWidth:CGFloat = UIScreen.main.bounds.width - 32.0
// Set frame width of each column using (containerWidth * percentage)
HStack (spacing:0) {
HStack {
Text("Column 25% Width")
}
.frame(width: containerWidth * 0.25)
HStack {
@meetbryce
meetbryce / Add API stage as key, value (property) to POST data in API Gateway
Created September 11, 2016 14:06
Template for adding new key:value pair (property) to your AWS API Gateway Body Mapping Template
{
"stage" : "$context.stage",
#foreach( $key in $input.path('$').keySet() )
"$key": "$input.path('$').get($key)"#if($foreach.hasNext),
#end
#end
}
@ntoniazzi
ntoniazzi / SamlLogoutHandler.php
Created May 4, 2016 12:13
Single Logout with LightSaml
<?php
/* SamlLogoutHandler.php, in the main project or a dedicated bundle */
namespace AcmeBundle\Lib;
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
use Exception;
use LightSaml\Binding\AbstractBinding;
use LightSaml\Binding\BindingFactory;
use LightSaml\Context\Profile\MessageContext;
@chatchavan
chatchavan / SDImage.sh
Last active April 18, 2024 07:11
Create a disk image from an SD card and write the disk image to another SD card (Mac OS X)
#!/bin/bash
### NOTE
# Ideally, you should create an image from small partition (e.g., 4 GB) instead of the whole SD card (e.g., 32 GB).
# For example, an image for Raspbian image should be created by the following procdure:
# (1) Install the official Raspbian image (3.5 GB for Jessie) on an SD card
# (2) Manually expand the partition to a modest size to accommodate your base software (e.g., 4 GB)
# (3) Perform apt-get update and upgrade, install software and configuration that you want.
# (4) Create an image from that (4 GB) partition
#
@yegor256
yegor256 / Agents.java
Last active February 18, 2022 19:02
Object-oriented dependency injection
final Agent agent = new Agent.Iterative(
new Array<Agent>(
new Understands(
this.github,
new QnSince(
49092213,
new QnReferredTo(
this.github.users().self().login(),
new QnParametrized(
new Question.FirstOf(
@Psvensso
Psvensso / Gulpfile.js
Created March 2, 2014 23:16
Starting Gulpfile for EmberJS with custom minispade, templating, SASS compillation... worx on my machine...
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@bwaidelich
bwaidelich / ExistsValidator.php
Last active November 9, 2023 10:39
TYPO3 Flow – Unique & Exists Validators
<?php
namespace My\Package\Validation;
use TYPO3\Flow\Persistence\RepositoryInterface;
class ExistsValidator extends \TYPO3\Flow\Validation\Validator\AbstractValidator {
/**
* @var array
*/
@kdambekalns
kdambekalns / composer.json
Created September 25, 2012 18:57 — forked from christianjul/composer.json
FLOW3 Barebone manifest
{
"name": "christianjul/barebone-flow3",
"description" : "Barebone FLOW3 project",
"license": "LGPL-3.0+",
"authors": [
{
"name": "Christian Jul Jensen",
"email": "julle@typo3.org"
}
],
@moklett
moklett / openconnect.md
Created July 24, 2012 15:21
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect