Skip to content

Instantly share code, notes, and snippets.

View lgaches's full-sized avatar

Laurent Gaches lgaches

View GitHub Profile
@floriankugler
floriankugler / AutoLayoutHelpers.swift
Last active August 30, 2023 21:17
Very simple key path based Auto Layout helpers
import UIKit
typealias Constraint = (UIView, UIView) -> NSLayoutConstraint
func equal<L, Axis>(_ to: KeyPath<UIView, L>, constant: CGFloat = 0) -> Constraint where L: NSLayoutAnchor<Axis> {
return equal(to, to, constant: constant)
}
func equal<L, Axis>(_ from: KeyPath<UIView, L>, _ to: KeyPath<UIView, L>, constant: CGFloat = 0) -> Constraint where L: NSLayoutAnchor<Axis> {
return { view1, view2 in
@mackuba
mackuba / wwdc16.md
Last active March 5, 2023 21:28
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

@norio-nomura
norio-nomura / build-package.sh
Created December 13, 2015 03:13
Script For Building OSX Installer Package of Swift-2.2-SNAPSHOT
#!/usr/bin/env bash
[ ! -x swift/utils/build-script ] && exit 1
SNAPSHOT_DATE=`date "+%Y-%m-%d"`
HASH_LLVM=`(cd llvm;git rev-parse --short HEAD)`
HASH_CLANG=`(cd clang;git rev-parse --short HEAD)`
HASH_SWIFT=`(cd swift;git rev-parse --short HEAD)`
HASH_INFO="LLVM ${HASH_LLVM}, Clang ${HASH_CLANG}, Swift ${HASH_SWIFT}"
BUNDLE_IDENTIFIER="io.nor.swift.${SNAPSHOT_DATE}" # "CFBundleIdentifier for xctoolchain info plist"
@markd2
markd2 / testprof.m
Last active June 2, 2017 16:43
code coverage on the command line
#import <stdio.h>
// xcrun clang -g -Wall -Werror -fprofile-instr-generate -fcoverage-mapping -o testprof testprof.m
// ./testprof
// xcrun llvm-profdata merge -o testprof.profdata default.profraw
// xcrun llvm-cov show ./testprof -instr-profile=testprof.profdata testprof.m
static int DoSomething (int value) {
if (value == 55) {
@chriseidhof
chriseidhof / LICENSE
Last active July 16, 2019 13:14
A tiny networking library
Copyright 2015 Chris Eidhof
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE
source 'http://rubygems.org'
# Make sure you have bundler installed
# gem install bundler
gem 'shenzhen'
@rponte
rponte / GenerateSimplePdfReportWithJasperReports.java
Last active May 7, 2022 10:25
Example on how to generate a simple pdf report with JasperReports
package rponte.report;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
@skeeet
skeeet / xcode_ramdisk.sh
Created April 12, 2012 13:35 — forked from MaximKeegan/xcode_ramdisk.sh
Create a RAM disk for using with XCode
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@chriseidhof
chriseidhof / nsincrementalstore.markdown
Created February 18, 2012 16:39
Accessing an API using CoreData's NSIncrementalStore

Accessing an API using CoreData's NSIncrementalStore

Note: the original location of this article is on my blog, however, it is posted here too for better readability.

In this article, we will see how to use Core Data for accessing your API. We will use the Bandcamp API as our running example. I've only been experimenting with this code for a few days, so there might be mistakes in there.

@glaforge
glaforge / build.gradle
Created November 25, 2011 16:04 — forked from Dierk/build.gradle
build.gradle for setting up a new gradle-based project
apply plugin:'groovy'
apply plugin:'idea'
repositories { mavenCentral() }
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.8.4'
}
task makeDirs(description:'make all dirs for project setup') << {