Skip to content

Instantly share code, notes, and snippets.

View cuibonobo's full-sized avatar

Jen Garcia cuibonobo

View GitHub Profile
@cuibonobo
cuibonobo / javascript-error.md
Last active August 29, 2015 14:00
Blog post about how I can only get focus to work if the page throws an error.

I'm trying to apply focus to the element that had it last after a page load, like this:

lastFocus.container.focus();

where lastFocus is the jQuery element that had been focused on last before the page load.

When I first load the page, the user hasn't focused on anything, so I just set lastFocus to document.activeElement. It should be focusable, but the console throws Uncaught TypeError: Cannot call method 'focus' of undefined.

The strange thing is that even if I change the code so that it doesn't run on the initial load, the first time it tries to focus will always throw the error. Plus, the code always works after the error is thrown at least once. In fact, if I put the code inside a try...catch, the fields never achieve focus properly.

Riot is so small... Why don't you make components like editable divs and tag fields mini applications? They are in charge of monitoring their internal state and rendering themselves. All that's needed is a wrapper app that outputs the model and the HTML element the model is tied to.

Also: I've figured out the right format for the task-creation app. Create an image tagging module that creates a new task when a new tag is created. So the flow would be:

  1. Load all of the storyboards for an act and parse their names for scene information
  2. For every storyboard, enter tagging mode.
  3. For every tag, pop up a window that lets you fill out the name, costume, angle, and description

All that information can live inside the storyboard asset itself so then you can pipe the storyboard assets through an app that creates illustration tasks from storyboard data.

Apps

Calendar

  • Infinite scroll view so that events can easily bleed into other months
  • Ability to define non-work days so that events won't be scheduled into them when they're moved around
  • Event types so that different departments can be tracked with different colors
  • Event links so that things that depend on each other behave as they should

Batch processing view

@cuibonobo
cuibonobo / elasticsearch_exact_match.md
Created July 2, 2014 21:43
How to get an exact match for a field in Elasticsearch.

This method is extremely slow, but if you've tokenized your fields in a certain way and don't want to re-index them to include exact matches, this is a good way to go.

{
    "query" : {
        "filtered" : {
            "query" : {
                "match_all": {}
            },
 "filter" : {
@cuibonobo
cuibonobo / before_after.md
Created July 10, 2014 01:54
Comparing two images
@cuibonobo
cuibonobo / update_episode_tags.py
Created July 10, 2014 21:00
Query Eve for entries that contain both episode 6xx and 5xx.
from api import API
from api.file_handling import make_data_patch
assets = API('http://isis.floydcounty.tv/api/', 'assets')
episode_num = 13
episode_range = ["%02d" % (e, ) for e in range(1, episode_num + 1)]
for episode in episode_range:
needle = '6' + episode
print("Querying for episode %s..." % needle)
query = '?where={"$and":[{"content.episode":"6' + episode + '"},{"content.episode":"5' + episode + '"}]}'
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@cuibonobo
cuibonobo / github-to-gitlab.md
Created July 15, 2014 21:23
Moving from GitHub to GitLab with DigitalOcean. (Taken from http://tyler.io/2014/03/switching-from-github-to-gitlab/)

Source

Switching from GitHub to GitLab

I've been a happy paying customer of [GitHub][1] since early 2009. But yesterday, for a few different reasons, I deleted all of my private repositories and moved them over to a self-hosted installation of [GitLab][2]. I didn't make that decision lightly, as I've been very happy with GitHub for the last five years, but here's why…

First, I've started working on a new Mac app. Every time I start a new project, unless it's open source, I create a new private repo for it on GitHub. This project happened to be my 21st private repository on GitHub. If you're familiar with their pricing structure, you'll know they charge based on how many private projects you have. $22 a month will get you twenty repos. But as soon as you create that twenty-first one, you graduate onto the $50 a month plan. Maybe if I were actually hosting 50 repositories with GitHub I'd be willing

@cuibonobo
cuibonobo / gitlab-on-digitalocean.md
Created July 16, 2014 18:09
Creating a GitLab instance on a 512MB DigitalOcean droplet.

502 Bad Gateway Error

The quick fix is to run the following:

@cuibonobo
cuibonobo / SassMeister-input-HTML.html
Created July 20, 2014 00:22
Use rem units in CSS as if they were pixels. Also includes a pixel fallback for older browsers.
<html>
<head>
<title>This.</title>
</head>
<body>
<p>This.</p>
</body>
</html>