Skip to content

Instantly share code, notes, and snippets.

View rickdaalhuizen90's full-sized avatar

Rick Daalhuizen rickdaalhuizen90

  • Belgium
  • 10:42 (UTC -12:00)
View GitHub Profile
@rickdaalhuizen90
rickdaalhuizen90 / db_schema.xml
Last active June 21, 2020 12:34
Magento 2 declarative schema without created_at
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="quote_item_file" resource="default" engine="innodb" comment="Quote Item File Table">
<column xsi:type="int" name="entity_id" padding="11" unsigned="false" nullable="false" identity="true"
comment="Entity ID"/>
<column xsi:type="varchar" name="filename" nullable="false" length="255"
comment="Filename"/>
<column xsi:type="varchar" name="location" nullable="false" length="255"
comment="Location of file"/>
<column xsi:type="int" name="quote_item_item_id" padding="10" unsigned="true" nullable="false" identity="false"
@rickdaalhuizen90
rickdaalhuizen90 / db_schema.xml
Last active June 14, 2020 16:20
Magento 2 declarative schema example
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="quote_item_file" resource="default" engine="innodb" comment="Quote Item File Table">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true"
comment="Entity ID"/>
<column xsi:type="varchar" name="filename" nullable="false" length="255"
comment="Filename"/>
<column xsi:type="varchar" name="location" nullable="false" length="255"
comment="Location of file"/>
@rickdaalhuizen90
rickdaalhuizen90 / gulp.js
Created April 12, 2020 11:31
Responsive images
const gulp = require('gulp');
const responsive = require('gulp-responsive');
gulp.task('build:responsive', () => {
return gulp
.src(['static/media/*.{gif,jpg,jpeg,png}'])
.pipe(responsive({
'**/*': [{
width: 2240,
height: 320,
@rickdaalhuizen90
rickdaalhuizen90 / gulp.js
Created April 12, 2020 11:31
Responsive images
const gulp = require('gulp');
const responsive = require('gulp-responsive');
gulp.task('build:responsive', () => {
return gulp
.src(['static/media/*.{gif,jpg,jpeg,png}'])
.pipe(responsive({
'**/*': [{
width: 2240,
height: 320,
@rickdaalhuizen90
rickdaalhuizen90 / Feed.svelte
Created April 5, 2020 16:02
Consuming XML in svelte
<script>
import { onMount } from "svelte";
let articles = [];
let show = false;
function getContent(xmlObj, tagName) {
return xmlObj.getElementsByTagName(tagName)[0].textContent
}
onMount(async () => {
@rickdaalhuizen90
rickdaalhuizen90 / app.js
Created January 9, 2020 19:39
Shortest solution to FizzBuzz in Javascript
'use strict'
for(let i=0;i<100;i++)console.log((i%3?'':'Fizz')+(i%5?'':'Buzz')||i);
@rickdaalhuizen90
rickdaalhuizen90 / client.php
Last active September 26, 2023 17:17
PHP OAuth client for Magento 2 REST API
<?php
/*
* OAuth 1.0a client (Example) for Magento 2
*
* @see: https://oauth.net/core/1.0a
* @see: https://tools.ietf.org/html/rfc5849
*/
class Api
{
const OAUTH_VERSION = '1.0';
@rickdaalhuizen90
rickdaalhuizen90 / script.php
Last active July 31, 2023 01:50
PHP script that removes duplicate fields in a csv
<?php
/*
Read a csv file and remove duplicate values,
and update the csv with unique values
*/
($argc > 1)
or die('No argument has been given! Example: script.php foo.csv'.PHP_EOL);
(pathinfo($argv[1], PATHINFO_EXTENSION) === 'csv')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: sans-serif;
font-size: 1.3em;
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Vue</title>
<script src="https://unpkg.com/vue"></script>
<style id="jsbin-css">
.dashboard {
display: flex;
flex-direction: row;
width: 100%;