Skip to content

Instantly share code, notes, and snippets.

@Toolo
Toolo / react-fixed-bottom.js
Last active November 14, 2019 09:42
Sample usage of stick to bottom
import React from 'react';
import PropTypes from 'prop-types';
// https://github.com/turo/react-fixed-bottom
import FixedBottom from 'react-fixed-bottom';
const MyBottomBar = ({onLeftClick, onRightClick}) => (
<FixedBottom offset={20}>
<div className="myBottomBar">
<button onClick={onLeftClick} type="button">Left</button>
<button onClick={onRightClick} type="button">Right</button>
@Toolo
Toolo / react-fixed-bottom.js
Last active February 2, 2021 01:40
React component with proper fixed bottom support for Safari mobile
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import throttle from 'lodash.throttle';
const SAFARI_MOBILE_BOTTOM_MENU_HEIGHT = 44;
export default class FixedBottom extends Component {
static propTypes = {
children: PropTypes.element.isRequired,
offset: PropTypes.number,
@Toolo
Toolo / vanilla-stick-to-bottom.js
Created March 15, 2019 16:04
Proper fixed: bottom in Safari
/**
* 44px is the height of the Safari overflow bar
*/
const SAFARI_MOBILE_BOTTOM_MENU_HEIGHT = 44;
/**
* Import from a library such as lodash or implement your own. Scroll events
* should always be throttled or debounced.
*/
const throttle = () => {};
public String getThumbnailUrl() {
return "https://placeholdit.imgix.net/~text?txtsize=14&bg=" + thumbnailUrl.substring(thumbnailUrl.length() - 6, thumbnailUrl.length()) + "&txt=HELLOWORLD&w=150&h=150";
}
package com.toolodev.common.network;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
package com.arte.quicknotes.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.BaseColumns;
public class NotesDbHelper extends SQLiteOpenHelper {
// If you change the database schema, you must increment the database version.
public static final int DATABASE_VERSION = 1;
package com.arte.quicknotes.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
public class NotesDataSource implements NotesStorage{