Skip to content

Instantly share code, notes, and snippets.

View seifscape's full-sized avatar
:octocat:

Seif Kobrosly seifscape

:octocat:
View GitHub Profile
@hastyeagle
hastyeagle / export_messages.py
Last active July 17, 2022 15:43 — forked from nomicode/export_chat.py
Export iOS/iMessage chat logs to HTML or text
#!/usr/bin/env python
import sys
import argparse
import urllib
import urlparse
import base64
import mimetypes
import cgi
import sqlite3
@stinger
stinger / Swift3JSONStructs.swift
Last active May 26, 2023 10:58
Swift 3: JSON-serializable structs using protocols
//: # Swift 3: JSON-serializable structs using protocols
//: Most of the implementation is based on the code in [this blog post](http://codelle.com/blog/2016/5/an-easy-way-to-convert-swift-structs-to-json/)
import Foundation
//: ### Defining the protocols
protocol JSONRepresentable {
var JSONRepresentation: Any { get }
}
protocol JSONSerializable: JSONRepresentable {}
@lornajane
lornajane / mac.md
Last active April 17, 2025 05:05
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@soffes
soffes / UISplitViewController+Soffes.swift
Created June 8, 2016 22:23
Easily access master and detail view controllers on UISplitViewController
import UIKit
extension UISplitViewController {
convenience init(masterViewController: UIViewController, detailViewController: UIViewController) {
self.init()
viewControllers = [masterViewController, detailViewController]
}
var masterViewController: UIViewController? {
return viewControllers.first
@rcugut
rcugut / node-npm-install.md
Last active February 2, 2024 11:51 — forked from DanHerbert/fix-homebrew-npm.md
Install node & npm on Mac OS X with Homebrew

DEPRECATED as of macOS 10.13 (High Sierra). See the new GUIDE to install nvm and yarn for macOS (updated July 2019)

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 19, 2025 08:59
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
func main() {
var z = 0
func goto(label: String) {
switch label {
case "start":
goto("cond")
case "cond":
if z == 5 {
goto("end")
} else {
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 5, 2025 02:07
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 registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@pirafrank
pirafrank / uninstall_office_2016.sh
Last active September 23, 2024 21:19
Uninstall Office 2016 from OS X completely
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
@MaximAlien
MaximAlien / AttrStrForButton
Last active May 24, 2019 15:08
[iOS] Attributed string for UIButton
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:@"test1"];
[attributeString addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, [attributeString length])];
[attributeString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15.0f] range:NSMakeRange(0, [attributeString length])];
NSMutableAttributedString *attributeNewString = [[NSMutableAttributedString alloc] initWithString:@"test2"];
[attributeString appendAttributedString:attributeNewString];
self.testButton.titleLabel.attributedText = attributeString;
// Image attachment