Skip to content

Instantly share code, notes, and snippets.

Mickaël Floc'hlay dirtyhenry

Block or report user

Report or block dirtyhenry

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dirtyhenry
dirtyhenry / MyCell.swift
Created Oct 19, 2017
Definitive UICollectionViewCell dynamic size
View MyCell.swift
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 / keychain.swift
Created Jun 26, 2017
How to log and delete keychain items from your iOS app?
View keychain.swift
func iterateKeychainItems(log: Bool, delete: Bool) {
let secItemClasses = [
kSecClassGenericPassword,
kSecClassInternetPassword,
kSecClassCertificate,
kSecClassKey,
kSecClassIdentity
]
if (log) {
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
gem 'cocoapods'
gem 'fastlane'
gem 'jazzy'
@dirtyhenry
dirtyhenry / appannie_histogram.R
Created Sep 14, 2016
R Script to get a plot of weekly/monthly downloads aggregations from App Annie files.
View appannie_histogram.R
#
# 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.
View test.css
body {
background-color: red;
}
@dirtyhenry
dirtyhenry / linear-optimization.rb
Created Aug 5, 2015
MITx 15.071x - Unit 8 - Linear Optimization - Radiation Therapy: An Application of Linear Optimization
View linear-optimization.rb
# 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 / timezones.txt
Created May 31, 2015
iOS 8 Known Time Zones
View timezones.txt
# #ifdef DEBUG
# NSArray *timeZones = [NSTimeZone knownTimeZoneNames];
# for(NSString *timeZone in timeZones) {
# DDLogDebug(@"%@", timeZone);
# }
# #endif
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
@dirtyhenry
dirtyhenry / .bowerrc
Last active Aug 29, 2015
The Rails' Bootstrap
View .bowerrc
{
"directory": "vendor/assets/components"
}
@dirtyhenry
dirtyhenry / random-bug.html
Last active Aug 29, 2015
Deezer SDK : random loss of the current_track event
View random-bug.html
<!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 / SmackAPITest.java
Created Jan 14, 2014
Fooling around the Smack API (a unit test + a POM to get the dependencies)
View SmackAPITest.java
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;
You can’t perform that action at this time.