Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@rickyngk
rickyngk / export.py
Created May 17, 2017 15:18
Export XCode string files to excel
import fnmatch
import os
import xlsxwriter
import collections
texts = {}
for root, dirnames, filenames in os.walk('./YourAwesomeProject/'):
for filename in fnmatch.filter(filenames, '*.strings'):
dirs = root.split("/")
@oleander
oleander / Makefile
Created April 6, 2017 12:26
How to use the Swift Package Manager and CocoaPods within the same XCode application
APP="MyApp"
CONSTRUCT=xcodebuild -workspace $(APP).xcworkspace -scheme $(APP) clean
install_deps:
pod install
create_config:
swift package fetch
swift package generate-xcodeproj
wipe:
rm -rf .build $(APP).xcodeproj $(APP).xcworkspace Package.pins Pods Podfile.lock
@eMdOS
eMdOS / NibLoadableView.swift
Last active October 15, 2021 12:29
Reusable views and cell registration and dequeuing (for table views and collection views)
protocol NibLoadableView: class {
static var nibName: String { get }
}
extension NibLoadableView where Self: UIView {
static var nibName: String {
return String(describing: self)
}
}
@navidurrahman
navidurrahman / bitbucket_project.groovy
Last active October 3, 2019 18:16
Jenkins Job DSL Example - Bitbucket project and branches
// URL components
String baseUrl = "https://bitbucket.org/rest/api"
String version = "1.0"
String project = "SYS"
// Put it all together
String reposUrl = [baseUrl, version, "projects", project, "repos"].join("/")
def send_request(url_string){
// Create URL

Using Swift Package Manager with iOS

Step 1:

File > New > Project...

Step 2:

Create a Package.swift file in your root project directory, add dependencies, then run swift package fetch on the command line in the same directory. We’re not going to run swift build because it will just complain.

@smswz
smswz / GridLayout.swift
Last active July 3, 2023 15:51
A simple custom grid UICollectionViewLayout
// MIT License
//
// Copyright (c) 2016 stable|kernel
//
// 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:
@kevin-smets
kevin-smets / 1_kubernetes_on_macOS.md
Last active March 16, 2025 22:37
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@gilbitron
gilbitron / ApiController.php
Last active July 21, 2020 01:05
ApiController Template for Laravel Spark
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
abstract class ApiController extends Controller
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files: