Skip to content

Instantly share code, notes, and snippets.

Ian Beck onecrayon

Block or report user

Report or block onecrayon

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
@onecrayon
onecrayon / ContentPostPage.vue
Last active Aug 23, 2019
Pages with next/prev links in Gridsome 0.6.x
View ContentPostPage.vue
<template>
<layout>
<!-- Here there be markup... -->
</layout>
</template>
<page-query>
query Chapter ($id: String, $prevId: String, $nextId: String) {
post: contentPost (id: $id) {
title,
@onecrayon
onecrayon / Pipfile
Last active Jul 28, 2019
async/await FastAPI with SQLAlchemy test
View Pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
[packages]
sqlalchemy = "*"
@onecrayon
onecrayon / README.md
Last active Dec 21, 2019
Use git installed in Windows Subsystem for Linux in Visual Studio Code
View README.md

Proxy commands from Windows command line to Bash using the Windows Subsystem for Linux (WSL)

These scripts allow you to proxy commands (specifically git, in this example) to the Windows Subsystem for Linux from the normal Windows command line environment. This allows you to work with a single installation of git (under your Linux distribution) instead of trying to manage two concurrent installations.

I explicitly created these scripts to allow using Git in Visual Studio Code without installing it under Windows.

Please note that I have not extensively tested edge cases! If you run into problems, please let me know!

Using WSL git in Visual Studio Code

View zendesk_autopopulate_fields.js
/**
* Automatically populates Zendesk public-facing "new ticket" fields
* on page load.
*
* To use, copy and paste into your New Request Page template (wrapped
* in a `<script></script>` tag).
*
* For most fields, just use the field name (so if the field is
* `request[subject]`, use `subject` in the URL, while
* `request[custom_fields][123456]` becomes `123456`). You can also use
@onecrayon
onecrayon / example_models.py
Created Dec 13, 2016
Custom MappedCollection example for SQLAlchemy returning a dict of lists
View example_models.py
from sqlalchemy import Model, Column, Integer, ForeignKey, String, Text
from orm_helpers import KeyedListCollection
class ItemAttribute(Model):
__tablename__ = 'item_attributes'
id = Column(Integer, primary_key=True, autoincrement=True)
item_id = Column(Integer, ForeignKey('items.id'))
attribute = Column(String(255))
value = Column(Text)
@onecrayon
onecrayon / dropbox-git-init.sh
Created Oct 4, 2016
Bash script for automatically creating a bare git repo in Dropbox (for tracking pre-existing private repo)
View dropbox-git-init.sh
##
# This script adds a new git repo to Dropbox (named after the current working
# directory), adds it as a remote, and pushes everything to it. If there is an
# argument, then that will be used as the name of the repo instead of the
# current working directory.
#
# EXAMPLE USAGE:
#
# $ cd existing-repo
# $ /path/to/dropbox-git-init.sh
View flattenArray.js
/**
* flattenArray(nestedArray)
*
* Accepts an array of values and arrays and returns
* a single array of values.
*
* Usage:
*
* var nested = [[1, 2, [3]], 4];
* var flat = flattenArray(nested);
@onecrayon
onecrayon / fiddle.log.js
Last active Aug 29, 2015
In-pane logging for JSFiddle
View fiddle.log.js
/**
* fiddle.log()
*
* An alternative to console.log that will output log items within the window;
* written primarily for use with Javascript-only JSFiddles
*
* https://gist.github.com/onecrayon/8cb83d129e971b6bfec9
*
* Copyright 2014 Ian Beck, released under an MIT license
*/
@onecrayon
onecrayon / Languages.xml
Created Aug 1, 2013
Basic code necessary for a LESS/SASS shim Sugar for MacRabbit's Espresso
View Languages.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<language id="com.onecrayon.less-sass-standin">
<root-zone>language-root.css</root-zone>
<name>LESS/SASS (shim)</name>
<detectors>
<extension>less</extension>
<extension>scss</extension>
@onecrayon
onecrayon / Postbox.plist
Created Jul 6, 2012
Postbox-style keybindings for MailMate (save in ~/Library/Application Support/MailMate/Resources/KeyBindings)
View Postbox.plist
{
// Keybindings to emulate Postbox defaults in MailMate
// From: http://www.postbox-inc.com/support/postbox_shortcuts
// Created by Ian Beck <http://beckism.com>
"f" = "nextMessage:";
"b" = "previousMessage:";
"n" = "nextUnreadMessage:";
"p" = "previousUnreadMessage:";
"T" = "nextUnreadThread:";
You can’t perform that action at this time.