Skip to content

Instantly share code, notes, and snippets.

View mokagio's full-sized avatar
🛠️
Building stuff

Gio Lodi mokagio

🛠️
Building stuff
View GitHub Profile
@tancredi
tancredi / boom.js
Created December 11, 2013 00:08
Node.js Super Mario build complete ASCII log
module.exports = function () {
console.log(
' \n\n' +
' ███████ ███████\n' +
' ████------████ ██\n' +
' ██------------██ ██\n' +
' ██------████████████ ██\n' +
' ██------████████████████ ██\n' +
' ██--████ ██████\n' +
' ████████ ██ ██ ██----██ ██████████████████████████████████████████████\n' +
@emarashliev
emarashliev / A+EatApple.m
Last active January 1, 2016 17:59
Override Methods with Categories
#import "A.h"
#import <objc/runtime.h>
@implementation A (EatApple)
- (void)printAppleOverride
{
[self printAppleOverride];
NSLog(@"Eat that Apple");
}
@bjeanes
bjeanes / docker-buildkite-ubuntu-14.04.sh
Last active May 30, 2016 06:08
Little script for me to pipe over SSH to a fresh Ubuntu VPS/VM to get it running a docker agent (used with cloudatcost.com as cheap build boxes)
#!/usr/bin/env bash
if [ -z "$BUILDKITE_AGENT_TOKEN" ]; then
echo
>&2 echo "No buildkite agent token set! Set BUILDKITE_AGENT_TOKEN"
exit 1
fi
touch ~/.ssh/authorized_keys
chmod 700 ~/.ssh
@hipertracker
hipertracker / Nested.elm
Last active September 13, 2018 14:05
Decoding nested JSON string
module Nested exposing (api)
import Json.Decode exposing (at, int, string, list, decodeString, Decoder)
import Json.Decode.Pipeline exposing (decode, required, optional, hardcoded)
data : String
data =
"""
{"languages":
#!/bin/bash
# taken from blog post: http://www.mokacoding.com/blog/automatic-xcode-versioning-with-git/
# Automatically sets version of target based on most recent tag in git
# Automatically sets build number to number of commits
#
# Add script to build phase in xcode at the top of the chain named "set build number"
# put this script in the root of the xcode project in a directory called scripts (good idea to version control this too)
# call the script as $SRCROOT/scripts/set_build_number.sh in xcode
#
# Set the build number to the current git commit count.
# If we're using the Dev scheme, then we'll suffix the build
# number with the current branch name, to make collisions
# far less likely across feature branches.
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
#
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list --all |wc -l`
if [ $CONFIGURATION = "Debug" ]; then
@andyyhope
andyyhope / SwiftEvolution_EnumCaseCountFunctionality_AndyyHope.md
Last active March 12, 2020 13:05
Swift Evolution - Enum Case Count Functionality

Swift Evolution Proposal

Author: Andyy Hope

Enum Values() Functionality (Update)

It has been brought to my attention that there was more use for the unintended values() functionality that I had outline in my "Other Languages" Java example below.

On the Swift Evolution mailing list, one developer outlined their requirement to loop through an array of enum case values to add different states to objects.

Another example where a values array would be useful if the developer wants to do something different for each different case, such as setting an image on a UIButton subclass for each different UIControlState

@phynet
phynet / bridging-error.mkd
Last active August 13, 2020 20:35
implicit import bridging header in module is deprecated

now in swift 4 you just have to import a briding header into Test target and reference objc-class .h files there...using @testable import nameOfYourApp should work

In Swift there's a message in "Test Target" that states that the bridging header will be removed in newer versions of swift. I'm using mixed objc and swift clasess, but the UnitTest class is a swift file. Using @testable key was there in code

  @testable import YourProject

You fix it by adding in your Test area the bridging header with objc headers that your test will use:

@phatblat
phatblat / package-ida.sh
Created May 11, 2015 16:53
A quick script to package up an .ipa correctly since `xcodebuild -exportArchive` misses the required SwiftSupport and WatchKitSupport folders
#!/bin/bash -e
#
# package-ipa.sh
#
# Bundles an iOS app correctly, using the same directory structure that Xcode does when using the export functionality.
#
xcarchive="$1"
output_ipa="$2"
@sharplet
sharplet / Example.swift
Created November 3, 2017 17:46
An improved wrapper for UIImagePickerController
// Here is a usage example. Refer to ImagePicker.swift below for the implementation!
// 1. Easily configure the picker
let cameraPicker = ImagePicker(sourceType: .camera)
let cropPicker = ImagePicker(sourceType: .photoLibrary, allowsEditing: true)
// Automatically includes both kUTTypeImage and kUTTypeLivePhoto
let livePhotoPicker = ImagePicker(sourceType: .photoLibrary, mediaTypes: [.livePhotos])
// 2. Use the picker