Skip to content

Instantly share code, notes, and snippets.

Frederik Jacques frederik-jacques

Block or report user

Report or block frederik-jacques

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
@frederik-jacques
frederik-jacques / Boolean+extensions.swift
Created Sep 13, 2017
Easily map to a value based on the value of a Boolean
View Boolean+extensions.swift
import Foundation
extension Bool {
/// Convenience method to map the value of a Boolean to a specific Type.
///
/// - Parameters:
/// - ifTrue: The result when the Boolean is true
/// - ifFalse: The result when the Boolean is false
/// - Returns: Returns the result of a specific Type
View Attributed string bug?
/*
Version one
-> Expected result
String shows Devine rocks, background set to purple for the whole string
Background set to red for the word 'rocks'
-> Got expected result (http://cl.ly/image/2Q1u0D1B0u0V)
*/
@frederik-jacques
frederik-jacques / Enumerate available font names
Created Mar 10, 2015
A Swift function to loop over all available font families and print out the different font names. You need this if you want to use custom fonts in your app and pass in the name for the UIFont class.
View Enumerate available font names
func enumerateFonts(){
for fontFamily in UIFont.familyNames() {
println("Font family name = \(fontFamily as String)");
for fontName in UIFont.fontNamesForFamilyName(fontFamily as String) {
println("- Font name = \(fontName)");
@frederik-jacques
frederik-jacques / objc_enumerate_fonts
Created Mar 13, 2013
Enumerate all fonts on your IOS device with this convenience method. Handy to find the name for your custom font!
View objc_enumerate_fonts
- (void)enumerateFonts {
NSLog(@"--Start enumerating font--");
for (NSString *fontFamilyStrings in [UIFont familyNames]) {
NSLog(@"Font family: %@", fontFamilyStrings);
for (NSString *fontStrings in [UIFont fontNamesForFamilyName:fontFamilyStrings]) {
NSLog(@"-- Font: %@", fontStrings);
}
}
NSLog(@"--End enumerating font--");
@frederik-jacques
frederik-jacques / belgian_cities_sql_dump
Last active Dec 11, 2015
SQL dump of all the Belgian cities linked to their provinces. Thanks to @anthonyvanoyen and @jverdeyen for pointing me to some start files.
View belgian_cities_sql_dump
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Table structure for table `cities`
--
CREATE TABLE `cities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`province_id` int(11) NOT NULL,
You can’t perform that action at this time.