Skip to content

Instantly share code, notes, and snippets.

View ade-adisa's full-sized avatar

Ade Adisa ade-adisa

View GitHub Profile
@tomasbasham
tomasbasham / UIImage+Scale.m
Last active February 1, 2024 19:04
Scale a UIImage to any given rect keeping the aspect ratio
@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.
@PurpleBooth
PurpleBooth / README-Template.md
Last active November 19, 2024 11:04
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@gandhiShepard
gandhiShepard / react-filter-map-example.js
Created September 25, 2015 15:44
React .filter and .map example
// 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; })
@gokulkrishh
gokulkrishh / media-query.css
Last active November 10, 2024 02:00
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
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
@javebratt
javebratt / firebase-storage.ts
Last active September 13, 2017 19:12
Firebase Storage example
// 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 => {
@mittalyashu
mittalyashu / fetch_data_in_react.js
Created April 8, 2018 06:54
Fetch Data From RSS Feed In React
class FetchDataFromRSSFeed extends Component {
constructor() {
super();
this.state = {
recentBlogPost: {
name: '',
url: ''
}
}
}
@edwinlee
edwinlee / Code.gs
Last active October 29, 2024 15:10
Sync a Google Sheets spreadsheet to a Firebase Realtime database
/**
* 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>"
};