Skip to content

Instantly share code, notes, and snippets.

View dirtyhenry's full-sized avatar

Mick F dirtyhenry

View GitHub Profile
@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 / random-bug.html
Last active August 29, 2015 14:12
Deezer SDK : random loss of the current_track event
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://cdn-files.deezer.com/js/min/dz.js"></script>
<style type="text/css">
@dirtyhenry
dirtyhenry / .bowerrc
Last active August 29, 2015 14:13
The Rails' Bootstrap
{
"directory": "vendor/assets/components"
}
@dirtyhenry
dirtyhenry / timezones.txt
Created May 31, 2015 13:09
iOS 8 Known Time Zones
# #ifdef DEBUG
# NSArray *timeZones = [NSTimeZone knownTimeZoneNames];
# for(NSString *timeZone in timeZones) {
# DDLogDebug(@"%@", timeZone);
# }
# #endif
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
@dirtyhenry
dirtyhenry / linear-optimization.rb
Created August 5, 2015 15:19
MITx 15.071x - Unit 8 - Linear Optimization - Radiation Therapy: An Application of Linear Optimization
# Unit 8 of the Analytics Edge
#
# Minimize :
# z = (1 + 2) * X1 + (2 + 2.5) * X2 + 2.5 * X3 + X4 + 2 * X5 + (1 + 2 + 1) * X6
#
# Beamlet
# 1 - 1 2 2 0 0 0 0 0 0
# 2 - 0 0 0 1 2 2.5 0 0 0
# 3 - 0 0 0 0 0 0 1.5 1.5 2.5
# 4 - 1 0 0 2 0 0 1 0 0
@dirtyhenry
dirtyhenry / test.css
Created November 16, 2015 13:53
Temp.css
body {
background-color: red;
}
@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 / keychain.swift
Created June 26, 2017 11:27
How to log and delete keychain items from your iOS app?
func iterateKeychainItems(log: Bool, delete: Bool) {
let secItemClasses = [
kSecClassGenericPassword,
kSecClassInternetPassword,
kSecClassCertificate,
kSecClassKey,
kSecClassIdentity
]
if (log) {