Skip to content

Instantly share code, notes, and snippets.

View shaulhameed's full-sized avatar
🎯
Focusing

Shaul Hameed shaulhameed

🎯
Focusing
View GitHub Profile
// PEOPLE
\ud83d\ude00
\ud83d\ude2c
\ud83d\ude01
\ud83d\ude02
\ud83d\ude03
\ud83d\ude04
\ud83d\ude05
\ud83d\ude06
@shaulhameed
shaulhameed / electron-cli.sh
Last active December 6, 2016 10:13
Electron cli
electron-cli () {
if [ -z $1 ]
then
echo "Usage:: electron-cli create || electron-cli create [projectname]"
return
fi
if [ $1 == "create" ]
then
if [ $2 ]
then
@shaulhameed
shaulhameed / heightForView.swift
Created August 10, 2016 08:59
Height for label based on text
func heightForView(text:String, #font:UIFont, #width:CGFloat) -> CGFloat{
let label:UILabel = UILabel(frame: CGRectMake(0, 0, width, CGFloat.max))
label.numberOfLines = 0
label.lineBreakMode = NSLineBreakMode.ByWordWrapping
label.font = font
label.text = text
label.sizeToFit()
return label.frame.height
@shaulhameed
shaulhameed / stringInterpolation.js
Created June 27, 2016 15:23
String Interpolation in javascript like C#
//@description - String interpolation.
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
@shaulhameed
shaulhameed / universal-framework.sh
Created June 19, 2016 20:06 — forked from cromanderrr/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@shaulhameed
shaulhameed / regexhelper.swift
Created June 16, 2016 12:03
Regex helper for Swift
extension String{
func replace(pattern: String, replaceWith: String) throws -> String{
print(self)
let internalExpression = try NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions.CaseInsensitive)
let modString = internalExpression.stringByReplacingMatchesInString(self, options: NSMatchingOptions.Anchored, range: NSMakeRange(0, self.characters.count), withTemplate: replaceWith)
return modString
}
}
try
@shaulhameed
shaulhameed / hacks.css
Last active December 7, 2016 15:59
CSS HACKS
.center-vertical {
transform: translateY(-50%);
top:50%;
position: absolute;
}
.center-horizontal {
transform: translateX(-50%);
left:50%;
position: absolute;
@shaulhameed
shaulhameed / GitCommands.md
Last active September 26, 2016 12:11
GIT Commands

##Renaming a GIT Branch

Step1: $ git branch -m <old_name> <new_name> - This will rename the branch locally

Step2: $ git push origin :<old_name> - Deletes the old branch remotely

Step3: $ git push --set-upstream origin <new_name> - Push the renamed branch to remote and update the upstream

@shaulhameed
shaulhameed / vi.md
Last active December 22, 2015 08:34
Vi Commands

Begin edit mode

:i

quit

:q
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},