Skip to content

Instantly share code, notes, and snippets.

View eytanbiala's full-sized avatar

Eytan Biala eytanbiala

View GitHub Profile

Keybase proof

I hereby claim:

  • I am eytanbiala on github.
  • I am eytan (https://keybase.io/eytan) on keybase.
  • I have a public key ASC79tdMtjrcqWCsy7pm3Hh6G8WXB-FJ4puI-aHbIw91Cwo

To claim this, I am signing this object:

@eytanbiala
eytanbiala / PSPDFUIKitMainThreadGuard.m
Last active August 29, 2015 14:27 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
@eytanbiala
eytanbiala / NSObject_Swizzle.h
Last active August 29, 2015 14:27 — forked from rudyjahchan/NSObject_Swizzle.h
Monkey-Patching iOS with Objective-C Categories Part III: Swizzling
#import <Foundation/Foundation.h>
@interface NSObject (Swizzle)
+ (void)swizzleInstanceSelector:(SEL)originalSelector
withNewSelector:(SEL)newSelector;
@end
#import <Foundation/Foundation.h>
#import <MessageUI/MessageUI.h>
@interface NSURL (MailComposeViewController)
// Is the given request a mailto URL.
- (BOOL)isMailtoRequest;
@end
<?php
// get the post UID from the URL
$uid = param('post');
if(!$uid) die(a::json(array(
'status' => 'error',
'msg' => 'The post could not be found',
)));
@eytanbiala
eytanbiala / Secure.java
Created November 22, 2013 23:36
Calculates the MD5 hash of str using the RSA MD5 Message-Digest Algorithm, and returns that hash.
import java.security.*;
public class Secure {
public static void main(String[] args) {
final String pass = "password";
String encrypted = MD5(pass);
System.out.println("Encrypted password: " + encrypted);
}
@eytanbiala
eytanbiala / SimpleMail.php
Last active December 29, 2015 03:38
PHP snippet to send email through SMTP
<?php
require_once "Mail.php";
$from = "Sender <sender@example.com>";
$to = "Recipient <recipient@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "imap.gmail.com";
$username = "john.doe";
<?php
// get the post UID from the URL
$uid = param('post');
if(!$uid) die(a::json(array(
'status' => 'error',
'msg' => 'The post could not be found',
)));
.videoWrapper {
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;