Skip to content

Instantly share code, notes, and snippets.

View ahbou's full-sized avatar
shipping

Ahmed Bouchfaa ahbou

shipping
View GitHub Profile
@m
m / gist:f27ae57113e34392c6d5
Created May 30, 2015 14:16
Auto-unsubscribe on Unroll.me
var i = 0;
function unroll_me_unsubscribe() {
// Bail if share modal (indicating free limit reached) is encountered.
if ( jQuery( '#fb-root' ).length > 0 ) { return; }
var unsub_link = jQuery( '.LetterList a.uicon-set-unsubscribe:first' );
if ( unsub_link.length > 0 ) {
document.getElementById( unsub_link.attr( 'id' ) ).click();
if ( i++ < 6000 ) { /* Upper limit in case something goes wrong. */
setTimeout( unroll_me_unsubscribe, 1500 );
}
@74monkeys
74monkeys / AdHocManifestTemplate.plist
Created September 25, 2014 19:37
Manifest Template for OTA iOS Ad Hoc Distribution
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@xaviervia
xaviervia / README.md
Created August 30, 2013 23:38
How to effectibly use AVAsset and AVAssetExportSession to convert files between .mov and .m4v on Mac OS X using the "User Selected File Read/Write Access" entitlement
  • Don't forget to link the (IBAction)doSelect: to some kind of button otherwise nothing will happen.
@katowulf
katowulf / push_notifications.js
Last active December 2, 2016 23:53
Push notifications from Firebase to Twilio.
//require the Twilio module and create a REST client
var client = require('twilio')('ACCOUNT_SID', 'AUTH_TOKEN');
var Firebase = require('firebase');
var fb = new Firebase('FIREBASE_URL');
fb.auth('FIREBASE_SECRET', function(err) {
if( err ) { throw err; }
listenForEvents();
})
@joaomdmoura
joaomdmoura / page_scrapper.rb
Last active December 29, 2016 20:45
Pure Old Ruby Object (PORO) HTML scraper with a simple DSL
require 'nokogiri'
require 'open-uri'
class PageScrapper
attr_accessor :url, :selector
IMG_SRC_REGEX = /src="([a-zA-Z\/0-9:.-_]+\.[a-zA-Z]{3})/
URL_REGEX = /http[s]?:\/\/[a-zA-Z0-9].+\.[a-z]{2,3}(\.[a-z]{2})?/
def initialize(url)
@stollcri
stollcri / ReplayKitExample.m
Last active May 9, 2018 18:11
Created a "Single View Application" project and added ReplayKit code to the ViewController files
//
// ViewController.h
// ReplayKitExample
//
// Created by Christopher Stoll on 6/11/15.
// Copyright © 2015 Christopher Stoll. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <ReplayKit/ReplayKit.h>
@KentarouKanno
KentarouKanno / UILocalNotification.md
Last active June 23, 2018 22:50
UILocalNotification

UILocalNotification

★ 通知の初期化(ユーザーへの許可を促す)

let settings = UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)
UIApplication.shared.registerUserNotificationSettings(settings)
UIApplication.shared.registerForRemoteNotifications()

★ 通知を作成

@natecook1000
natecook1000 / nshipster-new-years-2016.md
Last active July 10, 2018 19:24
NSHipster New Year's 2016

Greetings and salutations, NSHipsters!

As the year winds down, it's a tradition here at NSHipster to ask you, dear readers, to offer up your favorite tricks and tips from the past year as gifts to your fellow hipsters. With iOS 9, El Capitan, brand new watch- and tvOS's, and the open-sourcing of some minor Apple-related tech, there's bound to be lots to share.

Submit your favorite piece of Swift or @objc trivia, helpful hints, unexpected discoveries, useful workarounds, useless fascinations, or anything else you found cool this year. Just comment below!

If you need inspiration, try [the list from last year][2015], or [from the year before][2014], or [from the year before that][2013].

@jarsen
jarsen / NSArrayMagic.m
Last active July 24, 2018 09:22
How to do lots of cool things with NSArray. Inspired by NSHipster and WWDC 2013 Session 228 - "Hidden Gems in Cocoa and Cocoa Touch"
NSArray *albums = @[[Album albumWithName:@"Random Access Memories" price:9.99f],
[Album albumWithName:@"Clarity" price:6.99f],
[Album albumWithName:@"Weekend in America" price:7.99f],
[Album albumWithName:@"Weekend in America" price:7.90f],
[Album albumWithName:@"Bangarang EP" price:2.99f]];
// Reversing an Array
__unused NSArray *reversed = albums.reverseObjectEnumerator.allObjects;
// PREDICATES
@shannoga
shannoga / gist:1008678
Created June 5, 2011 05:14
Get fonts family and font names list on iOS
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];