Skip to content

Instantly share code, notes, and snippets.

@kenwilcox
kenwilcox / fizz buzz.swift
Created June 23, 2017 05:07
FizzBuzz Count
var counter = [
"fizz": 0,
"buzz": 0,
"fizzbuzz": 0,
"numbers": 0
]
for i in 1...100 {
switch i {
case let x where (x % 3) == 0 && (x % 5) == 0:
@kenwilcox
kenwilcox / gist:796f035fbe1a579e4a2c8489aeacdfc3
Created September 11, 2016 21:42 — forked from adamstac/gist:8347083
Enable HiDPI mode on a VMware Fusion OS X 10.9 Mavericks Vagrant VM
  1. Set "Use full resolution for Retina display" in the VM's Settings > Display
  2. Run this command in Terminal sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionEnabled -bool true
  3. In System Preferences, set the display to "scaled" using the resolution 1292 x 807 (HiDPI)
  4. Enjoy.
@kenwilcox
kenwilcox / AddSlash.markdown
Last active August 29, 2015 14:21
AddSlash

AddSlash ('-' * 8) Wanted to create a function that added a slash to a url path, but only if it was needed. Also wanted it to be able to ignore any query string items

A Pen by kenwilcox on CodePen.

License.

@kenwilcox
kenwilcox / CarthageDistribution.md
Last active August 29, 2015 14:17
Building Alamofire framework for app distribution

Yesterday I was playing with Carthage for the first time. I got Alamofire to download and build in the simulator just fine.

However, when I tried to upload it to iTunes Connect it failed with PIE errors, invalid iOS min version... and something else, I don't remember...

What I did to get it to work:

  • Opened up the Alamofire workspace that Carthage downloaded for me.
  • On the project tab set the deployment target to 8.0
  • In Info.plist added MinimumOSVersion, string value of 8.0
  • Saved the project
  • Opened terminal to the Carthage/Checkouts/Alamofire directory
div#main.container>h1+table>tr.rows*4>td.cols*6>{Item $}^p
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
@kenwilcox
kenwilcox / gist:ce4da86f7264a85ff848
Created January 30, 2015 23:16
Setting IE Emulation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Windows.Forms;
namespace FixIE
{
public class IEEmulation
@kenwilcox
kenwilcox / setup.md
Last active August 29, 2015 14:08 — forked from bendyorke/setup.md
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@kenwilcox
kenwilcox / Pred
Last active August 29, 2015 14:07
using System;
using System.Collections.Generic;
namespace Pred
{
public class Pred
{
static void Main()
{
List<string> list = new List<string>();