Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Henrik Oldenborg

🏠
Working from home
View GitHub Profile
@Oldenborg
Oldenborg / AssertJson.php
Last active Oct 30, 2020
Laravel test trait: assert JSON exact
View AssertJson.php
<?php
namespace Tests;
use Illuminate\Testing\TestResponse;
use Illuminate\Support\Arr;
use PHPUnit\Framework\Assert as PHPUnit;
trait AssertJson
{
/* @before */
@Oldenborg
Oldenborg / how-to-not-bem.scss
Last active May 28, 2020
BEM grandchildren - yes or no?
View how-to-not-bem.scss
// Example #1
.tree__branch--green {
.twig__leaf {
color: green;
}
}
// Example #2
.tree__branch--green__twig__leaf {
color: green;
View prusa-scroll-fix.html
<a href="#" onclick="document.getElementById("block-order-detail").scrollIntoView();">This is my link text</a>
@Oldenborg
Oldenborg / triangle-of-doom.js
Created Nov 12, 2018
Example of the triangle of doom
View triangle-of-doom.js
const verifyUser = function(username, password, callback){
dataBase.verifyUser(username, password, (error, userInfo) => {
if (error) {
callback(error)
}else{
dataBase.getRoles(username, (error, roles) => {
if (error){
callback(error)
}else {
dataBase.logAccess(username, (error) => {
@Oldenborg
Oldenborg / products.vue
Last active Nov 5, 2018
NetliftyCMS prerender folders
View products.vue
<template>
...
</template>
<script>
export default {
data() {
return {
product: Object
}
@Oldenborg
Oldenborg / vue.config.js
Last active Oct 2, 2018
This snippet will allow index files from the public folder to be copied to dist folder, this is nessesary in a Vue+NetlfiyCMS setup
View vue.config.js
module.exports = {
chainWebpack: config => {
config
.plugin('copy')
.use(require('copy-webpack-plugin'), [[{
from: 'public',
ignore: ['./index.html', '.DS_Store']
}]])
}
}
@Oldenborg
Oldenborg / diode.sass
Last active Nov 22, 2017
sass / css component to make a simple diode
View diode.sass
$block: diode
$diameter: 0.5rem
+component
width: $diameter
height: $diameter
background: $idle
display: inline-block
border: 2px solid white
margin-right: $margin_xs
View mix.sass
=vendor($attribute, $value)
-webkit-#{$attribute}: #{$value}
-moz-#{$attribute}: #{$value}
-ms-#{$attribute}: #{$value}
-o-#{$attribute}: #{$value}
#{$attribute}: #{$value}
=rotate($deg)
display: inline-block
+vendor(transform, rotate(#{$deg}deg))
@Oldenborg
Oldenborg / getSpecificModelRelationships.php
Last active Sep 27, 2016
Laravel - Get Model with specific relations
View getSpecificModelRelationships.php
<?php
$clinics = new Clinic;
if($request->modules)
{
foreach($request->modules as $module)
{
$clinics = $clinics->whereHas('modules', function ($query) use ($module) {
$query->where('modules.id',$module);
});
}
@Oldenborg
Oldenborg / global.sass
Last active Jan 16, 2021
Remove antpaths from focused elements
View global.sass
// Remove antpaths from focused elements
a:focus,
select:focus,
input:focus
outline: medium none !important
button:focus
outline: 0
button::-moz-focus-inner,