Skip to content

Instantly share code, notes, and snippets.

View dirtyhenry's full-sized avatar

Mick F dirtyhenry

View GitHub Profile
@dirtyhenry
dirtyhenry / agile-jira-workflow.xml
Created July 23, 2013 14:28
Agile JIRA Workflow Definition
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.8//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
<workflow>
<meta name="jira.update.author.key">mick</meta>
<meta name="jira.description">Agile JIRA Workflow Definition</meta>
<meta name="jira.updated.date">1374589472735</meta>
<initial-actions>
<action id="1" name="Create">
<validators>
<validator name="" type="class">
@dirtyhenry
dirtyhenry / S3permission
Last active December 23, 2015 18:29
This is the permission you need to set with Amazon AWS S3 to provide full access to a "mybucket" bucket and read-access only to all your buckets.
{
"Statement": [
{
"Effect": "Allow",
"Action": "S3:*",
"Resource": "arn:aws:s3:::mybucket/*",
"Condition": {}
},
{
"Effect": "Allow",
@dirtyhenry
dirtyhenry / bootstragram-dark.terminal
Created October 28, 2013 13:54
My Terminal configurations
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGHyBYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKUHCBEVHFUkbnVsbNQJCgsMDQ4PEFdOU1doaXRlXE5TQ29sb3JTcGFjZV8QEk5T
Q3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NCMAAQA4ACgATSEgwTFFROU0lEEAKAA9IWFxgZ
WiRjbGFzc25hbWVYJGNsYXNzZXNcTlNDb2xvclNwYWNlohobXE5TQ29sb3JTcGFjZVhO
@dirtyhenry
dirtyhenry / gist:7547064
Created November 19, 2013 15:27
iOS code that: 1/ validates an email found in a UITextField 2/ check chances of spelling mistakes
- (NSArray *)allMyContacts {
// cf. http://stackoverflow.com/questions/12083643/how-do-i-correctly-use-abaddressbookcreatewithoptions-method-in-ios-6
CFErrorRef error = nil;
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &error);
__block BOOL accessGranted = NO;
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
accessGranted = granted;
@dirtyhenry
dirtyhenry / SELECT.sql
Last active January 2, 2016 09:08
Spam identification for SPIP 3
SELECT auteur, email_auteur, LEFT(texte, 50)
FROM spip_forum
WHERE LEFT(texte, 20) LIKE '%http%'
AND statut <> 'spam'
ORDER BY maj DESC;
@dirtyhenry
dirtyhenry / SmackAPITest.java
Created January 14, 2014 14:58
Fooling around the Smack API (a unit test + a POM to get the dependencies)
package com.bootstragram.xmpp;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
@dirtyhenry
dirtyhenry / appannie_histogram.R
Created September 14, 2016 17:39
R Script to get a plot of weekly/monthly downloads aggregations from App Annie files.
#
# appannie_histogram.R
#
# Create weekly and monthly aggregations bar plots of your downloads
# from AppAnnie CSV files.
#
# Improvements:
#
# * First and last week of years can have much less than 7 days and create false
# decreases of downloads.
@dirtyhenry
dirtyhenry / Gemfile
Created June 26, 2017 10:23
iOS Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
gem 'cocoapods'
gem 'fastlane'
gem 'jazzy'
@dirtyhenry
dirtyhenry / MyCell.swift
Created October 19, 2017 14:53
Definitive UICollectionViewCell dynamic size
class FooCell: UICollectionViewCell {
private var sizingOnlyWidthConstraint: NSLayoutConstraint? = nil
func sizeWith(width: CGFloat, myString: String) -> CGSize {
if sizingOnlyWidthConstraint == nil {
sizingOnlyWidthConstraint = NSLayoutConstraint(item: self, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: width)
sizingOnlyWidthConstraint?.isActive = true
}
if sizingOnlyWidthConstraint!.constant != width {
@dirtyhenry
dirtyhenry / poc-openssl-aes.rb
Last active June 5, 2018 11:48
Encryption interoperability demo between Ruby and OpenSSL
require 'openssl'
require 'base64'
# Read the dummy file
data = File.read("test.txt")
# Create an encrypter
cipher = OpenSSL::Cipher::AES.new(256, :CBC)
cipher.encrypt
key = cipher.random_key