Skip to content

Instantly share code, notes, and snippets.

View martinnormark's full-sized avatar
:shipit:
Always Be Shipping

Martin Høst Normark martinnormark

:shipit:
Always Be Shipping
View GitHub Profile
@martinnormark
martinnormark / custom_instructions.txt
Created May 22, 2024 18:55
ChatGPT Custom Instructions
NEVER mention that you’re an AI.
Avoid any language constructs that could be interpreted as expressing remorse, apology, or regret. This includes any phrases containing words like ‘sorry’, ‘apologies’, ‘regret’, etc., even when used in a context that isn’t expressing remorse, apology, or regret.
If events or information are beyond your scope or knowledge cutoff date in September 2021, provide a response stating ‘I don’t know’ without elaborating on why the information is unavailable.
Refrain from disclaimers about you not being a professional or expert.
Keep responses unique and free of repetition.
Never suggest seeking information from elsewhere.
Always focus on the key points in my questions to determine my intent.
Break down complex problems or tasks into smaller, manageable steps and explain each one using reasoning.
Provide multiple perspectives or solutions.
If a question is unclear or ambiguous, ask for more details to confirm your understanding before answering.
var NUM_PARTICLES = ( ( ROWS = 100 ) * ( COLS = 300 ) ),
THICKNESS = Math.pow( 80, 2 ),
SPACING = 8,
MARGIN = 100,
DRAG = 0.95,
EASE = 0.25,
PARTICLE_SIZE = 5, // Size of each particle
PARTICLE_COLOR = {r: 0, g: 255, b: 0, a: 1}, // Color of each particle
DRAG = 0.95,
@martinnormark
martinnormark / BusinessLogicInstaller.cs
Created July 17, 2012 09:17
Castle Windsor IoC Container setup for ASP.NET MVC
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using MyApp.BusinessLogic.Facades;
namespace MyApp.Web.PresentationLogic.Container
{
public class BusinessLogicInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
@martinnormark
martinnormark / DynamicHelper.cs
Created May 2, 2012 08:11
C# Dynamic extension methods for serializing to XML
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
/// <summary>
/// Extension methods for the dynamic object.
/// </summary>
@martinnormark
martinnormark / BackgroundImageView.swift
Last active August 2, 2022 09:42
Full screen background view for iOS that adds blur and vibrancy effects.
class BackgroundImageView : UIView {
private let bgImage = UIImageView(forAutoLayout: ())
private var blurView:UIVisualEffectView!
private var vibrancyView:UIVisualEffectView!
private var didSetupConstraints = false
var containerView: UIView? = nil {
willSet(container) {
removeContainerViewFromSuperview()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Tilt</title>
</head>
<body style="padding: 50px">
<div class="js-tilt" style="width: 300px; height: 300px; background-color: burlywood; display: flex; justify-content: center; align-items: center; overflow: hidden">
<img
src="https://images.unsplash.com/photo-1632993952737-0c2897164db3?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyfHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60"
@martinnormark
martinnormark / d3-mouse-over-line.js
Created March 22, 2016 11:53
Adding a vertical line to a D3 chart, that follows the mouse pointer.
var vertical = d3.select(".chart")
.append("div")
.attr("class", "remove")
.style("position", "absolute")
.style("z-index", "19")
.style("width", "1px")
.style("height", "380px")
.style("top", "10px")
.style("bottom", "30px")
.style("left", "0px")
@martinnormark
martinnormark / LoginViewController.swift
Created December 31, 2014 14:38
Correctly scaling a full size background image in iOS, to seamlessly transition from launch image
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.whiteColor()
let screenSize: CGRect = UIScreen.mainScreen().bounds
var bgImage = UIImageView(image: UIImage(named: "login-bg"))
bgImage.center = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height / 2)
bgImage.transform = CGAffineTransformMakeScale(screenSize.width / 414, screenSize.height / 736)
using System;
using System.Windows;
using System.Windows.Threading;
namespace WpfApp1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
@martinnormark
martinnormark / pr-cli-merge.ps1
Created May 7, 2021 06:27
Quickly merge multiple Pull Requests from PowerShell.
$prs = gh pr list | Select-String -Pattern "\d\d\d" | Select-object -last 10
([regex]"\d\d\d").matches($prs) | % { gh pr merge $_.value -m -d }