Skip to content

Instantly share code, notes, and snippets.

Jørgen Vatle JorgenVatle

Block or report user

Report or block JorgenVatle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JorgenVatle
JorgenVatle / find-replace.sh
Last active Mar 25, 2019
Find & Replace magic
View find-replace.sh
#########################################################
# JS kebab case to single word without apostrophes
## Find:
/'.+-(.+)'\s?:/g
## Replace with:
$1:
## Example use:
View ReviewReactions.vue
<template>
<div>
<span v-if="selectedReaction === 'agree'">
You and {{ agree }} others disagree to this
</span>
<span v-else-if="selectedReaction === 'disagree'">
You and {{disagree}} others disagree to this
</span>
</div>
</template>
View ReviewReactions.js
export default {
name: 'review-reactions',
props: ['agree', 'disagree', 'id'],
template: '<div>' +
' <span v-if="display === \'agree\'">' +
' You and {{ agree }} others disagree to this' +
' </span>' +
' <span v-else-if="display === \'disagree\'">' +
' You and {{ disagree }} others disagree to this' +
' </span>' +
@JorgenVatle
JorgenVatle / mmodel.xml
Created Aug 26, 2018
PHPStorm live template for ATShop/ATPay styled models.
View mmodel.xml
<template name="mmodel" value="import { Mongo } from 'meteor/mongo';&#10;&#10;const $ModelName$Collection = new Mongo.Collection('$CollectionName$');&#10;&#10;interface $ModelName$Document extends ModelDocument {&#10; // Todo: Fill in document properties.&#10;}&#10;&#10;interface $ModelName$ extends $ModelName$Document {&#10; entry: $ModelName$Document&#10;}&#10;&#10;class $ModelName$ extends Model {&#10; &#10; /**&#10; * Mongo collection this model is responsible for.&#10; */&#10; static readonly collection = $ModelName$Collection;&#10; &#10; /**&#10; * $ModelName$ constructor.&#10; *&#10; */&#10; constructor(docOrId: DocumentOrId) {&#10; super(docOrId, $ModelName$Collection)&#10; }&#10; &#10; // Add model methods and relationships.&#10; &#10;}&#10;&#10;export default $ModelName$" description="Creates a Meteor Model class" toReformat="false" toShortenFQNames="true">
<variable name="ModelName" expression="" defaultValue="" alwaysStopAt="true" />
View npm ddp-client example.js
// Todo: grab shop from `admin.shops` subscription.
const shopId = shops[0]._id; // The `_id` field on a Shop object contains your shopId.
/*
* Subscribe to a Meteor Collection
*/
ddpclient.subscribe(
'admin.orders', // Meteor subscription name
[shopId], // Any parameters to pass to the Meteor subscription.
View cloudflare-update-ip-ranges.sh
#!/bin/bash
# All credit goes to Marek Bosman.
# Source: https://marekbosman.com/site/automatic-update-of-cloudflare-ip-addresses-in-nginx/
# Location of the nginx config file that contains the CloudFlare IP addresses.
CF_NGINX_CONFIG="/etc/nginx/cloudflare"
# The URLs with the actual IP addresses used by CloudFlare.
CF_URL_IP4="https://www.cloudflare.com/ips-v4"
View URLs from HTML files.re
// Finds URLs! Source: http://www.regexpal.com/93826
(((http|ftp|https):\/{2})+(([0-9a-z_-]+\.)+(aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mn|mo|mp|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|nom|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ra|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw|arpa)(:[0-9]+)?((\/([~0-9a-zA-Z\#\+\%@\.\/_-]+))?(\?[0-9a-zA-Z\+\%@\/&\[\];=_-]+)?)?))
@JorgenVatle
JorgenVatle / keybase.md
Created Jan 18, 2017
Keybase Identity Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am JorgenVatle on github.
  • I am warthy (https://keybase.io/warthy) on keybase.
  • I have a public key whose fingerprint is 2682 17D1 A59B 6678 628C 8920 FF4C 482E BFF8 E15D

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am Warthelm on github.
  • I am warthy (https://keybase.io/warthy) on keybase.
  • I have a public key whose fingerprint is 2682 17D1 A59B 6678 628C 8920 FF4C 482E BFF8 E15D

To claim this, I am signing this object:

You can’t perform that action at this time.