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
@implementation UIImage (scale) | |
/** | |
* Scales an image to fit within a bounds with a size governed by | |
* the passed size. Also keeps the aspect ratio. | |
* | |
* Switch MIN to MAX for aspect fill instead of fit. | |
* | |
* @param newSize the size of the bounds the image must fit within. | |
* @return a new scaled image. |
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
// via: Learn Raw React — no JSX, no Flux, no ES6, no Webpack… | |
// http://jamesknelson.com/learn-raw-react-no-jsx-flux-es6-webpack | |
var contacts = [ | |
{key: 1, name: "James Nelson", email: "[email protected]"}, | |
{key: 2, name: "Bob"} | |
] | |
var listElements = contacts | |
.filter(function(contact) { return contact.email; }) |
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
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
/* CSS */ | |
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
extension UITextField { | |
func underlined(){ | |
let border = CALayer() | |
let width = CGFloat(1.0) | |
border.borderColor = UIColor.lightGrayColor().CGColor | |
border.frame = CGRect(x: 0, y: self.frame.size.height - width, width: self.frame.size.width, height: self.frame.size.height) | |
border.borderWidth = width | |
self.layer.addSublayer(border) | |
self.layer.masksToBounds = true |
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
// Create a reference to Firebase Storage | |
this.driverProfilePictureRef = firebase.storage().ref('/driverProfilePicture/'); | |
// Upload the picture to Firebase Storage | |
const uploadPicture = this.driverProfilePictureRef.child("driver's id") | |
.child('profilePicture.png').putString(pictureInBase64StringHere, 'base64', {contentType: 'image/png'}); | |
// After the picture successfully uploads, you'll want to add that picture's url to the drivers node | |
uploadPicture.then( profilePicture => { |
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
class FetchDataFromRSSFeed extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
recentBlogPost: { | |
name: '', | |
url: '' | |
} | |
} | |
} |
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
/** | |
* Copyright 2019 Google LLC. | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
function getEnvironment() { | |
var environment = { | |
spreadsheetID: "<REPLACE WITH YOUR SPREADSHEET ID>", | |
firebaseUrl: "<REPLACE WITH YOUR REALTIME DB URL>" | |
}; |