Skip to content

Instantly share code, notes, and snippets.

Frederic Barthelemy fbartho

Block or report user

Report or block fbartho

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
fbartho / openx_bash_for_ios
Last active Oct 30, 2018 — forked from johngraham262/openx_bash_for_ios
A simple bash script that will open a `.xcworkspace` if it exists in the current directory, otherwise a `.xcodeproj` if it exists, otherwise nothing. It will print the name of the file that is being opened. When using Cocoapods with iOS apps, a second file is created with the `MyProject.xcworkspace` name, alongside the `MyProject.xcproject` file…
View openx_bash_for_ios
# Add the following lines of code to your `~/.bash_profile`,
# and then run `source ~/.bash_profile` to be able to execute
# this from the command line.
# Originally from:
# Spaces-in-filenames from:
openx() {
find . -maxdepth 1 -name *.xcworkspace -print0 | while IFS= read -r -d '' file; do
View AsyncMap-DispatchSemaphore.swift
let arr = [1, 2, 3, 4, 5]
func someAsyncAPI(_ entry: Int, completion: @escaping (Int) -> Void) {
let sleepTime = max(0,3-entry) .now() + 0.1 * Double(sleepTime)) {
completion(entry * -1);
fbartho /
Created Apr 8, 2018
noahhaasis/conwaysGameOfLife Feedback on Request

noahhaasis/conwaysGameOfLife Feedback


  • Most of my feedback is going to be superficial and possibly wrong!
  • I'm not an active expert in C.
  • I haven't used the SDL toolkit since college.
  • I didn't run this code, I simply looked at it!


fbartho / 0. Synology RAID Expansion-Resync
Last active Jul 8, 2019
Walkthrough of what I did to increase performance on my Synology NAS box during an expansion, and afterwards.
View 0. Synology RAID Expansion-Resync

Performance on Synology RAIDs

(especially while expanding)

Warning: The exact commands may not match for your particular linux OS / Synology(NAS) device. I had to customize the commands after exploring my particular system's setup.

If you're new to linux, or this is a new piece of hardware / a new synology device, jump down to the section called "Inspecting a setup"


fbartho /
Created Aug 4, 2017
Example of a Swift file that breaks swiftformat --self remove
swiftformat --self remove tmp.swift
fbartho / StencilHello.swift
Created Mar 16, 2017
Stencil -- basic templates get no output?
View StencilHello.swift
// ???
import Stencil
let environment = Environment()
let context = ["name": "kyle"]
print(try environment.renderTemplate(string: "Hello {{ name }}", context: context))
Produces output:

Keybase proof

I hereby claim:

  • I am fbartho on github.
  • I am fbartho ( on keybase.
  • I have a public key ASBi_0J2KRTAirbomlqcoJ_cyDLRbwneneb5MeMGl9qedwo

To claim this, I am signing this object:

fbartho / lazy_optional_ternary_fixit_bug.swift
Created Jul 21, 2016
Xcode8 beta 3: Nested Ternaries operating on optionals in a lazy-var initializer have a fixit that grabs the wrong block to fixup
View lazy_optional_ternary_fixit_bug.swift
class Original {
var opt1: String? = nil
var opt2: String? = nil
enum Foo : String {
case unknown
case one
case two
// Compile flags an error w/ fixit suggestion on line 11 relating to not using optionals directly as booleans
lazy var type: Foo = {
fbartho / xcode-toggle.bash
Last active Aug 29, 2015
Bash implementation
View xcode-toggle.bash
`xcode-select -p | grep -i beta > /dev/null`
if [ $? -eq 0 ]
echo "Using beta. Switching to release."
sudo xcode-select -s /Applications/
echo "Using release. Switching to beta."
sudo xcode-select -s /Applications/
fbartho / QuickStart-FBStackableURLCache.m
Last active Dec 15, 2015
Example integration of FBStackableURLCache
View QuickStart-FBStackableURLCache.m
// Note: Not pictured here: logic specific to the system that nukes the UICache.db if we know the content is probably out of date
* Make our base URL cache to the similar details as the standard default sharedURLCache in case someone is using it.
* From Apple Docs for NSURLCache:
* <li>Memory capacity: 4 megabytes (4 * 1024 * 1024 bytes)
* <li>Disk capacity: 20 megabytes (20 * 1024 * 1024 bytes)
* <li>Disk path: <nobr>(user home directory)/Library/Caches/(current application name)</nobr>
* <br>where:
* <br>user home directory is determined by calling
You can’t perform that action at this time.