Skip to content

Instantly share code, notes, and snippets.

View GLips's full-sized avatar

Graham Lipsman GLips

View GitHub Profile
import { useEffect } from "react";
import { AnalyticsBrowser, type Analytics } from "@june-so/analytics-next";
import { useInterval } from "@mantine/hooks";
const commands = ["page", "track", "identify"] as const;
type JuneCommands = (typeof commands)[number];
let hasSentPageview = false;
let analytics: Analytics | undefined;
@GLips
GLips / flagger.java
Created March 29, 2018 01:09
Use Scriptrunner for JIRA Cloud to automatically add a flag to an issue on transition
// Hardcoded ID for the "flagged" field.
issueInput.update.customfield_10600 = [[set: [[value: "Impediment"]]]]
@GLips
GLips / watcher.java
Last active March 22, 2018 22:45
Use Scriptrunner for JIRA Cloud to add the project's lead as a watcher
def issueKey = issue.key
def projectKey = issue.fields.project.key
def projectLead = get("/rest/api/2/project/${projectKey}").asObject(Map).body['lead']['key']
logger.info("Project lead: ${projectLead}")
// Docs for this endpoint: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-watchers-post
def result = post("/rest/api/2/issue/${issueKey}/watchers")
.header('Content-Type', 'application/json')
.body("\"${projectLead}\"")
@GLips
GLips / mpackager
Created June 19, 2014 19:02
Automatically tar up changed files between two different commits—e.g. `mpackager HEAD HEAD^` to tar up all the files changed in the most recent commit.
#!/bin/bash
git diff $1 $2 --name-only > updates.txt
tar zcf updates.tgz --files-from=updates.txt
rm updates.txt
echo "Created file updates.tgz with the following files:"
tar -tf updates.tgz
LW.StreamControlController = Ember.ObjectController.extend
sourceType: 'github'
sourceTypes: ['github', 'twitter']
createNewSource: (->
if @get('sourceType')
@clearNewSource()
sourceType = @get('sourceType') + '_source'
@set 'newParentSource', @store.createRecord('source', { stream: @get('model'), source_type: sourceType })
@set 'newSource', @store.createRecord(sourceType, { parent: @get('newParentSource') })
@get('newParentSource').set sourceType, @get('newSource')
LW.GithubSource = LW.Model.extend
# Example: [master, develop]
branches: DS.attr('array')
# Returns a list that looks like "master, and develop"
# If setting, just takes a comma separated list "master, develop" and turns it into [master, develop]
comma_branches: ((key, value)->
arguments[0] = 'branches'
@comma_separated.apply @, arguments
).property('branches')