This file contains 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
Reachability * networkReachability = [Reachability reachabilityForInternetConnection]; | |
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus]; | |
if (networkStatus == NotReachable) { | |
NSLog(@”There Is NO internet connection”); | |
// show no connection view | |
} else { | |
NSLog(@”There IS internet connection”); | |
// show connected view |
This file contains 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
cd Desktop/assets/ | |
mkdir images; mkdir icons | |
done | |
for file in $(find . -type f -iname '*-img*'); do | |
mv "$file" "images/${file/-images/}" | |
done | |
for file in $(find . -type f -iname '*-ic*'); do | |
mv "$file" "icons/${file/-icons/}" | |
done |
This file contains 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
Show hidden characters
// Add the following to `Sublime Text > Preferences > Keybindings - User` | |
[ | |
{ "keys": ["command+shift+;"], "command": "run_macro_file", "args": {"file": "Packages/User/EOL-semicolon.sublime-macro"} } | |
] | |
// The macros should look like the following | |
// The file should be placed in `cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/EOL-semicolon.sublime-macro` | |
[ | |
{ |
This file contains 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
def after_sign_in_path_for(resource) | |
if resource.sign_in_count == 1 | |
first_time_user_experience_path | |
else | |
your_apps_main_path | |
end | |
end |
This file contains 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
// Spacing Helpers | |
// -------------------------------------------------- | |
// ex: mtxl = margin-top: 20px | |
// | |
$orientation_list: ( | |
v, | |
h, | |
a | |
); | |
$direction_list: ( |
This file contains 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
// Displays message a message to a user who is offline | |
// Example using Boostrap classes | |
// <div id="offline" class="alert alert-danger">You're offline</div> | |
if (navigator.onLine) { | |
document.getElementById('offline').style.display = "block"; | |
} else { | |
console.log('User is online') | |
} |
This file contains 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
// Display your spinner by calling Loading.start() and hide it with Loading.stop() | |
// Include asset 'spinner.png' | |
import UIKit | |
class Loading { | |
static let backgroundColor = UIColor(red: 46.0/255.0, green: 204.0/255.0, blue: 113.0/255.0, alpha: 0.44) | |
static let fade = 0.1 | |
static var indicator: UIView = { | |
var view = UIView() |
This file contains 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
// Local Storage workaround: Stringify your object before storing it, and later parse it when you retrieve it | |
// Create object | |
var testObject = { 'one': 1, 'two': 2, 'three': 3 }; | |
// Put the object into storage | |
localStorage.setItem('testObject', JSON.stringify(testObject)); | |
// Retrieve the object from storage | |
var retrievedObject = localStorage.getItem('testObject'); |
This file contains 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
// Variables | |
$black : #000000; | |
$white : #FFFFFF; | |
$alpha : #FF0000; | |
$themes: ( | |
blue: ( | |
alpha: blue, | |
beta: orange | |
), |
This file contains 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
// Round number to 2 decimal places | |
@function decimal-round ($number, $digits: 0, $mode: round) { | |
$n: 1; | |
// $number must be a number | |
@if type-of($number) != number { | |
@warn '#{ $number } is not a number.'; | |
@return $number; | |
} | |
// $digits must be a unitless number | |
@if type-of($digits) != number { |
OlderNewer