Skip to content

Instantly share code, notes, and snippets.

@mamaz
mamaz / custom_keyboard_hint.txt
Created December 12, 2014 15:04
Hints for building Custom Keyboard App using Jenkins and xctools (XCode 6.1)
Notice for building Custom Keyboard App using Jenkins and xctools
# please use $(BUILT_PRODUCTS_DIR) as Installation Directory on Build Settings
# please specify $(SDKROOT)/ResourceRules.plist as Code Signing Resource Rules Path
# use 2 prov profile: containing app and custom keyboard extension
@mamaz
mamaz / withoutIndent.m
Created December 27, 2014 08:40
Make table separator without any indent
// iOS 7+
// on custom cell
- (void)awakeFromNib // or layoutSubviews
{
// make table separator without any indent
if ([self respondsToSelector:@selector(setLayoutMargins:)]) {
self.layoutMargins = UIEdgeInsetsZero;
}
@mamaz
mamaz / fabric.sh
Last active December 7, 2023 07:53
iOS build script for building and uploading to Fabric
#!/bin/sh
#
# Simple script for uploading binaries to Fabric (d/h Crashlytics)
#
# written by @taufik_obet
# modified for pushing to fabric by @hismamaz
#
#
@mamaz
mamaz / Podfile
Last active August 29, 2015 14:18
Simple Podfille for any projects
# to download
# curl -o Podfile https://gist.githubusercontent.com/mamaz/87909165fd6a5c496a6c/raw/dddf4aad97ecfda42ade1e0cc216fc8cad14e000/Podfile
platform :ios, '8.0'
inhibit_all_warnings!
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking', '2.5.2'
@mamaz
mamaz / registerPushNotif.m
Created May 7, 2015 13:03
Register push notification iOS 8 compliant
- (void)registerForPushNotifications
{
UIApplication *sharedApplication = [UIApplication sharedApplication];
if ([sharedApplication respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationType type = (UIUserNotificationTypeSound|UIUserNotificationTypeAlert|UIUserNotificationTypeBadge);
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:type
categories:nil];
[sharedApplication registerUserNotificationSettings:notificationSettings];
@mamaz
mamaz / NoMarigin
Last active August 29, 2015 14:23
No Marrgin left for UITableView iOS
// on VC
// remove spacing
if ([self.table respondsToSelector:@selector(setSeparatorInset:)]) { // Safety check for below iOS 7
[self.table setSeparatorInset:UIEdgeInsetsZero];
}
// on custom cell subclass
- (UIEdgeInsets)layoutMargins
{
return UIEdgeInsetsZero;
@mamaz
mamaz / Animate.m
Last active June 30, 2016 13:32
Animate using Autolayout the correct way
// source:
// http://stackoverflow.com/a/12664093/1328982
// credits to: Gervasio Marchand
- (void)moveBannerOffScreen {
[self.view layoutIfNeeded];
[self.childView mas_remakeConstraints:(MASConstraint* make){
make.top.mas_equal(0);
make.left.mas_equal(0);
@mamaz
mamaz / cell.m
Created September 8, 2015 09:47
Make sure one cell has only one button tap subscriber
// make sure one cell has one subscriber
[[thumbnailCell.checkMarkSignals
takeUntil:cell.rac_prepareForReuseSignal]
subscribeNext:^(id x) {}];
@mamaz
mamaz / mocha.js
Created December 29, 2015 10:00
Just a mocha template
var assert = require('assert');
var async = require('asyncawait/async');
var await = require('asyncawait/await');
describe('hooks', function() {
before(function() {
// runs before all tests in this block
});
@mamaz
mamaz / regex.txt
Created March 2, 2016 06:53
Regex for URL
/^http:\/\/|(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/