Skip to content

Instantly share code, notes, and snippets.

@andreaantonioni
andreaantonioni / ios-cell-registration-swift.md
Last active July 15, 2021 13:41 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
public func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)
@stefanbc
stefanbc / perms.md
Last active April 22, 2025 16:48
Set proper permissions on /var/www/

HOWTO

To set up permissions on /var/www where your files are served from by default:

sudo addgroup webmasters
sudo adduser $USER webmasters
sudo chown -R root:webmasters /var/www
sudo find /var/www -type f -exec chmod 664 {} \;
sudo find /var/www -type d -exec chmod 775 {} \;
@romantomjak
romantomjak / CustomRootCAAPIClient.h
Last active August 25, 2017 10:04
SSL with custom root CA certificate using AFNetworking 2.x on iOS 7 and iOS 8
//
// CustomRootCAAPIClient.h
//
// Created by Roman Tomjak on 19/12/14.
// Copyright (c) 2014 Roman Tomjak. All rights reserved.
//
#import <AFHTTPSessionManager.h>
@interface CustomRootCAAPIClient : AFHTTPSessionManager
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active September 30, 2025 20:46
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@geoffyuen
geoffyuen / gitftp.command
Last active December 28, 2015 22:09
bash script / OSX .command menu to use git ftp. Requirements: - GIT - GIT FTP - a GIT repro Put this in the folder you're working in and chmod 777 it.
#!/bin/bash
cd "$(dirname "$0")"
clear
echo "GIT FTP Menu (ctrl-c to abort)"
echo
PS3='Please enter your choice: '
options=("Commit" "Mock Upload" "Configure" "First Time Commit" "Quit")
select opt in "${options[@]}"
do
case $opt in
@sandeepkunkunuru
sandeepkunkunuru / SOAPClient.java
Last active September 5, 2019 09:56
WebService - Document(SOAP) mode invocation - https - Example - from Scratch - Without referencing any library specific or generated classes e.g. classes of axis, axis2, cxf etc.
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.Security;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@hkirsman
hkirsman / mobtable.html
Created June 27, 2012 08:34
turn tables into mobile friendly
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>table</title>
<style type="text/css">
.odd { background-color: #808080; }
.generated_for_mobile { margin-bottom: 30px }
@niepi
niepi / osx_php_homebrew.setup.md
Created February 28, 2012 13:23
OSX PHP Homebrew Setup

install php

with mysql pgsql intl support

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl

set php timezone in php ini

date.timezone = Europe/Vienna
<!doctype html>
<html lang="en">
<head>
<title>Huge Dropdown Menu (example)</title>
<style type="text/css">
body {
background-color: #86c6d7;
@flq
flq / NonTopmostPopup.cs
Created April 5, 2011 08:04
WPF: Popup that is only topmost with respect to parent window. Taken from the comments at http://chriscavanagh.wordpress.com/2008/08/13/non-topmost-wpf-popup/ (Joe Gershgorin) which was in not easy to digest state
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
/// <summary>
/// Popup with code to not be the topmost control