Skip to content

Instantly share code, notes, and snippets.

View two7sclash-zz's full-sized avatar
🕶️

James Fishwick two7sclash-zz

🕶️
View GitHub Profile
The MIT License (MIT)
Copyright (c) 2014 Devin Mancuso <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@two7sclash-zz
two7sclash-zz / gist:9ed3f2dd1eb06df8f03052ca4f343eb1
Created September 19, 2016 15:04
JIRA: Grooy Script Listener - update parent ticket to date of furthermost out subtask
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp
/**
* Set max DueDate of all subtasks to parent issue
@two7sclash-zz
two7sclash-zz / subtask-copier.groovy
Created September 19, 2016 15:09
subtask-copier.groovy
ComponentManager componentManager = ComponentManager.getInstance()
IssueManager issueManager = componentManager.getIssueManager()
SubTaskManager subTaskManager = componentManager.getSubTaskManager()
JiraAuthenticationContext authenticationContext = componentManager.getJiraAuthenticationContext()
IssueFactory issueFactory = componentManager.getIssueFactory();
ProjectRoleManager projectRoleManager = componentManager.getComponentInstanceOfType(com.atlassian.jira.security.roles.ProjectRoleManager.class)
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
ProjectManager projectManager = componentManager.getProjectManager()
GenericValue testCaseIssueType = subTaskManager.getSubTasksIssueTypes().find { it.name == 'Sub-task'}
@two7sclash-zz
two7sclash-zz / Contract Killer 3.md
Created September 19, 2016 15:10 — forked from MikeNGarrett/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@two7sclash-zz
two7sclash-zz / ValidateTwoDatesWorkflow.groovy
Created September 19, 2016 15:50 — forked from jusuchin85/ValidateTwoDatesWorkflow.groovy
A Groovy script to compare the Due Date field against the Resolved Date field. If the Resolved Date is after the Due Date, then the Target Met field would be set to "No". Otherwise, it would be set to "Yes"
/**
 * @author jalex
 * @version 1.0
 *
 * A Groovy script to compare the Due Date field against the Resolved Date field. If the Resolved Date is after the
 * Due Date, then the Target Met field would be set to "No". Otherwise, it would be set to "Yes"
 *
 */
import com.atlassian.jira.ComponentManager
@two7sclash-zz
two7sclash-zz / master.py
Created September 26, 2016 13:23
Python-Ruby bridge
from subprocess import Popen, PIPE, STDOUT
print 'launching slave process...'
slave = Popen(['ruby', 'slave.rb'], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
while True:
# read user input, expression to be evaluated:
line = raw_input('Enter expression or exit:')
# write that line to slave's stdin
slave.stdin.write(line+'\n')
@two7sclash-zz
two7sclash-zz / fred embed
Created October 12, 2016 14:05
fred embed
<iframe src="//fred.stlouisfed.org/graph/graph-landing.php?g=7GIZ&width=670&height=475" scrolling="no" frameborder="0" style="overflow:hidden; width:670px; height:525px;" allowTransparency="true"></iframe>
@two7sclash-zz
two7sclash-zz / latency_humanized.markdown
Created October 13, 2016 14:28
Latency numbers every programmer should know

Lets multiply all these durations by a billion:

Magnitudes:

Minute:

L1 cache reference                  0.5 s         One heart beat (0.5 s)
Branch mispredict                   5 s           Yawn
L2 cache reference                  7 s           Long yawn
Mutex lock/unlock                   25 s          Making a coffee
@two7sclash-zz
two7sclash-zz / replacer.py
Created October 19, 2016 01:07 — forked from yv84/replacer.py
Script to recursively replace string in filename and contents
"""
Usage: python script.py search_string replace_string dir
Eg. python batchreplace.py galleries productions /Sites/cjc/application/modules/productions/
And it will search recursively in dir
and replace search_string in contents
and in filenames.
Case-sensitive
"""
from sys import argv
@two7sclash-zz
two7sclash-zz / gist:c3835d83695b46ca2a6a4b6d71272538
Created November 29, 2016 19:39
Groovy Convert To Camel Case or Snake Case
static String toCamelCase( String text, boolean capitalized = false ) {
text = text.replaceAll( "(_)([A-Za-z0-9])", { Object[] it -> it[2].toUpperCase() } )
return capitalized ? capitalize(text) : text
}
static String toSnakeCase( String text ) {
text.replaceAll( /([A-Z])/, /_$1/ ).toLowerCase().replaceAll( /^_/, '' )
}