Skip to content

Instantly share code, notes, and snippets.

View embassem's full-sized avatar

Bassem Tourky embassem

View GitHub Profile
@embassem
embassem / DeleteManagedObjectsExtension.swift
Created January 26, 2016 09:53 — forked from collindonnell/DeleteManagedObjectsExtension.swift
NSManagedObjectContext extension methods to delete all managed objects, or all objects of a given type in the context.
//
// Created by Collin Donnell on 7/22/15.
// Copyright (c) 2015 Collin Donnell. All rights reserved.
//
import CoreData
extension NSManagedObjectContext {
convenience init(parentContext parent: NSManagedObjectContext, concurrencyType: NSManagedObjectContextConcurrencyType) {
@embassem
embassem / 0_reuse_code.js
Created February 9, 2016 07:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@embassem
embassem / Carthage Instructions.md
Last active February 15, 2016 10:18 — forked from pxlshpr/Carthage Instructions.md
These are the steps required to add and embed a framework into your project using Carthage.

cd ~/Path/To/Starter/Project touch Cartfile open -a Xcode Cartfile carthage update --platform iOS

  1. Add the URL of the framework's repo to your Cartfile using one of the following:
  github "ReactiveCocoa/ReactiveCocoa" # GitHub.com
  github "https://enterprise.local/ghe/desktop/git-error-translations" # GitHub Enterprise
  git "https://enterprise.local/desktop/git-error-translations2.git"
@embassem
embassem / mergegenstrings.py
Created April 17, 2016 11:56 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@embassem
embassem / genscreenshots.sh
Created April 17, 2016 12:09 — forked from yoichitgy/genscreenshots.sh
A shell script to generates screenshot images from PSD files to submit to iTunes Connect (App Store). It removes the alpha channel of the source 5.5 inch images, and resizes and crops them to generate 4.7, 4 and 3.5 inch images.
#!/bin/sh
# settings ==========
filePrefix=""
destDir="./output/"
destDir5_5=$destDir"5.5inch/"
destDir4_7=$destDir"4.7inch/"
destDir4=$destDir"4inch/"
destDir3_5=$destDir"3.5inch/"
@embassem
embassem / genassetimages.sh
Created April 17, 2016 12:09 — forked from yoichitgy/genassetimages.sh
A script to generates iOS asset PNG images from a PSD file for @1x, @2x and @3x scales.
#!/bin/sh
#
# genassetimages.sh
# Generates iOS asset PNG images from a PSD file for @1x, @2x and @3x scales.
# ImageMagick is used to resize the images.
#
# settings ==========
outputDir="image_assets"
assetSuffixes=(".png" "@2x.png" "@3x.png")
@embassem
embassem / Unity3D Ignore Folders
Created June 15, 2016 08:47
Unity3D Ignore Folders
#http://stackoverflow.com/questions/18225126/how-to-use-git-for-unity-source-control
# =============== #
# Unity generated #
# =============== #
Temp/
Library/
# ===================================== #
# Visual Studio / MonoDevelop generated #
@embassem
embassem / gist:5bed81094d52d43388be3c3ddd129951
Created June 18, 2016 14:32 — forked from bwhiteley/gist:049e4bede49e71a6d2e2
Initialize Swift subclass of UIView, designed in .xib
// Create CustomView.xib, set File's Owner to CustomView.
// Link the top level view in the XIB to the contentView outlet.
class CustomView : UIView {
@IBOutlet private var contentView:UIView?
// other outlets
override init(frame: CGRect) { // for using CustomView in code
super.init(frame: frame)
self.commonInit()
@embassem
embassem / gist:c65048d595588738c332d58030cf6f13
Created September 22, 2016 17:22 — forked from priore/gist:7163463
How to create a perfect circle UIView
#import <QuartzCore/QuartzCore.h>
// create a perfect circle view
- (UIView*)createCircleViewWithRadius:(int)radius
{
// circle view
UIView *circle = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 2 * radius, 2 * radius)] autorelease];
circle.layer.cornerRadius = radius;
circle.layer.masksToBounds = YES;
@embassem
embassem / countries.json
Created November 22, 2016 13:58 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},