Skip to content

Instantly share code, notes, and snippets.

View jpetto's full-sized avatar
🪐

Jonathan Petto (they/them) jpetto

🪐
View GitHub Profile
@jpetto
jpetto / gist:1903811
Created February 24, 2012 21:19
store/retrieve multiple select values to/from localstorage
// watch for changes to motivations select
$('#motivations').change(function() {
var selected = []; // create an array to hold all currently selected motivations
// loop through each available motivation
$('#motivations option').each(function() {
// if it's selected, add it to the array above
if (this.selected) {
selected.push(this.value);
}

Keybase proof

I hereby claim:

  • I am jpetto on github.
  • I am jpetto (https://keybase.io/jpetto) on keybase.
  • I have a public key ASAYfGgtiDCmyzB3UoE2C9nOKkMIHkfmuTeBHApk401xggo

To claim this, I am signing this object:

@jpetto
jpetto / optimizely-review-checklist.md
Last active March 26, 2020 22:21
Checklist for reviewing & starting Optimizely experiments

Optimizely Review Checklist

Experiment

  • URL targeting
  • Variation redirects
  • Variation code
  • Audience
  • Traffic allocation
  • Goal(s)
@jpetto
jpetto / l10n-keybindings.json
Last active October 20, 2017 15:43
VS Code keybindings for wrapping strings for L10n
{
"key": "cmd+shift+w",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "{{ _('${TM_SELECTED_TEXT}') }}"
}
},
{
"key": "cmd+shift+t",

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@jpetto
jpetto / gist:4988451
Created February 19, 2013 18:22
Simple guessing game
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleGuessingGame1
{
class Program
{
@jpetto
jpetto / post-checkout
Created May 4, 2016 14:56
Git post checkout hook for Python projects
#!/usr/bin/env python
import sys, os, re
from subprocess import check_output
prev_head = sys.argv[1]
new_head = sys.argv[2]
is_branch_checkout = sys.argv[3]
if is_branch_checkout == "0":
@jpetto
jpetto / desktop-base.html
Created April 13, 2016 15:44
Conditional content in an include
{% block site_footer %}
{% with new_links=True %}
{% include 'includes/site-footer.html' %}
{% endwith %}
{% endblock %}
@jpetto
jpetto / gist:8061109
Created December 20, 2013 20:36
Mozilla.org Pre-PR Questionnaire

Mozilla.org Pre-PR Questionnaire

  1. Did you set up a /b/ redirect and any other necessary rewrite rules?

  2. Did you let L10n know about all string changes?

  3. Did you optimize all images?

  4. Did you test with JavaScript disabled?

@jpetto
jpetto / alt-hitcallback-fix.js
Created December 2, 2013 22:38
Alternate hitCallback fix.
function gaTrack(eventArray, callback) {
// submit eventArray to GA and call callback only after tracking has
// been sent, or if sending fails.
//
// callback is optional.
//
// Example usage:
//
// $(function() {
// var handler = function(e) {