Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am trezy on github.
  • I am trezy (https://keybase.io/trezy) on keybase.
  • I have a public key ASDVjqCniDrZPVWFpJgs6OZeCxDriLqp1QwSOQrZY6G-YAo

To claim this, I am signing this object:

-- Get current sprite
local sourceSprite = app.activeSprite
-- Exit if we're not currently looking at a sprite
if not sourceSprite then
return app.alert("There is no active sprite")
end
-- Initiate the important variables
local executionDialog = Dialog("AwesomeExport is creating your sprite... ")
@trezy
trezy / blep.js
Last active April 13, 2019 07:20
// This is just a mock for our original command
const string = '!projects-add -f flag -b "Kirk\'s awesome string" -b "Kirk\'s awesome string" -b "Kirk\'s awesome string" something that won\'t work -r 999';
// Placeholder for the original command string as we replace string arguments
let stringWithReplacedArgs = string
// Use `.match()` to extract an array of all string arguments
const stringArgs = string.match(/(".*?")/g)
// Loop over the array of string args and make sure they're replaced with the appropriate index in our replaced string
// Module imports
import fs from 'fs'
import path from 'path'
function exportDirectory (requirePath) {
let exports = {}
@trezy
trezy / Collapsable.vue
Last active March 27, 2019 18:53
Weird Nuxt SSR issue
<template>
<div class="collapsable">
<input
:id="`${id}::collapsable-control`"
:name="[`${group}`]"
:type="[`${group ? 'radio' : 'checkbox'}`]" />
<label
v-on:click="handleClick"
:for="`${id}::collapsable-control`">
// `ctx` is an object that Koa.js passes through its middleware, allowing the
// middleware to modify it as they see fit. `ctx.request` and `ctx.response` are
// objects that reflect the contents of the HTTP request and response,
// respectively
var oldEtag = ctx.request.headers['if-none-match']
var newEtag = ctx.response.headers['etag']
ctx.fresh = (oldEtag !== newEtag)
function conditional() {
return function conditional(ctx, next) {
return next().then(() => {
if (ctx.fresh) {
ctx.status = 304;
ctx.body = null;
}
});
}
}
function etag(options) {
return function etag(ctx, next) {
return next()
// `getResponseEntity` checks to see if the response has a body, and
// stringifies it depending on what kind of body it has (JSON, HTML,
// image, etc)
.then(() => getResponseEntity(ctx))
// `setEtag` calculates the ETag from the response body if it exists,
// then sets that ETag as a header
@trezy
trezy / Head.jsx
Last active October 10, 2019 02:54
import NextHead from 'next/head'
import React from 'react'
import ReactGA from 'react-ga'
import Router from 'next/router'
/*****************************************************************************\
@trezy
trezy / Page.jsx
Last active September 14, 2017 20:37
// Module imports
import React from 'react'
import { bindActionCreators } from 'redux'
import { Provider } from 'react-redux'
import withRedux from 'next-redux-wrapper'