This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| override func viewDidLoad() | |
| { | |
| super.viewDidLoad() | |
| // Thanks http://stackoverflow.com/a/27665207 | |
| NSNotificationCenter.defaultCenter().addObserverForName( | |
| UIKeyboardWillChangeFrameNotification, | |
| object: nil, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import UIKit | |
| extension UIViewController { | |
| /// Whether the view is currently displayed in modal style. | |
| var isModal: Bool { | |
| return self.presentingViewController?.presentedViewController == self | |
| || self.navigationController?.presentingViewController?.presentedViewController == self.navigationController | |
| || self.tabBarController?.presentingViewController?.isKindOfClass(UITabBarController) == true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| import "math/rand" | |
| func main() { | |
| interactiveGame() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <body> | |
| <textarea rows=4 cols=40></textarea> | |
| <br/> | |
| <button onclick="saveTextarea()">Save text</button> | |
| <br/> | |
| <br/> | |
| <button onclick="save256Bytes()">Save example typed array as binary file</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <body> | |
| <style> | |
| .drop-area { | |
| display: inline-block; | |
| padding: 1em; | |
| border: thin dotted grey; | |
| border-radius: 1em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.macu.sppreader; | |
| import android.app.ProgressDialog; | |
| import android.bluetooth.BluetoothAdapter; | |
| import android.bluetooth.BluetoothDevice; | |
| import android.bluetooth.BluetoothSocket; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.util.Log; | |
| import android.view.View; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ensure all AVDs are closed, and your Android device is connected. | |
| # To make a backup of the ca.mattcudmore.day2day app: | |
| ~/Library/Android/sdk/platform-tools/adb backup -f backup.ab ca.mattcudmore.day2day | |
| # Convert the backup file to TAR: | |
| dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup.tar | |
| # Extract the TAR to access files. | |
| tar -xvf backup.tar | |
| # Now disconnect Android device and launch AVD where files will be copied to. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a data-toggle=".demo-layout .demo-target" href="#">[-]</a> | |
| <div class="demo-layout"> | |
| <div class="demo-target"> | |
| <p>Content hidden or displayed</p> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.post('/ajax/test', { | |
| field, | |
| }).then(response => { | |
| // Success | |
| }).fail((jqXHR) => { | |
| if (jqXHR.status === 409) { | |
| alert('Conflict'); | |
| } else { | |
| alert('Error code: ' + jqXHR.status); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YouTube embed regex: | |
| /<iframe\s+[^>]*?src="(?:(?:https?:)?\/\/)?(?:(?:www|m)\.)?(?:youtube\.com|youtu.be)(?:\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)[^">]*?"[^>]*>[^<]*<\/iframe>/ | |
| Vimeo embed regex: | |
| /<iframe\s+[^>]*?src="(?:(?:https?:)?\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/|)(\d+)\/?(?:[?]?[^">]*)"[^>]*>[^<]*<\/iframe>/ |