Skip to content

Instantly share code, notes, and snippets.

:octocat:

Mark Murphy MarkMurphy

:octocat:
Block or report user

Report or block MarkMurphy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Example.js
import React, { Component } from 'react'
import { View, Text } from 'react-native'
import Tabs from './Tabs'
import Tab from './Tabs/Tab'
export default class ExamplePage extends Component {
state = {
selectedTab: 1
}
@MarkMurphy
MarkMurphy / ListViewDemo.js
Created Jan 23, 2017
React Native Web - ListViewDemo
View ListViewDemo.js
import React, { Component } from 'react';
import { ListView, StyleSheet } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 20,
},
row: {
padding: '10px'
@MarkMurphy
MarkMurphy / README.md
Last active Feb 14, 2020
Cursor based pagination for Rails models.
View README.md

Example Usage

Users

id name
1 Jane
2 Max
3 John
4 Scott
@MarkMurphy
MarkMurphy / README.md
Last active Aug 7, 2016
Multipart Upload API
View README.md

Endpoints for uploading large files in multiple chunks. Also has the ability to resume if the upload is interrupted.

Typical usage:

  1. Send a POST request to /files with the first chunk of the file and receive an upload id in return.
  2. Repeatedly PATCH subsequent chunks using the upload id to identify the upload in progress and an offset representing the number of bytes transferred so far.
  3. After each chunk has been uploaded, the server returns a new offset representing the total amount transferred.
  4. After the last chunk commit the upload by passing its id to another endpoint such as POST /videos, POST /audio, etc.

Example:

@MarkMurphy
MarkMurphy / AlbumPage.js
Last active May 24, 2016
redux-crud pagination
View AlbumPage.js
// containers/AlbumPage.js
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { browserHistory } from 'react-router'
import { fetchAlbum, deleteAlbum } from '../actions/albums'
import { listPhotos } from '../actions/photos'
import bindAll from 'lodash/bindAll'
import AlbumHeader from '../components/AlbumHeader'
import PhotoGallery from '../components/PhotoGallery'
@MarkMurphy
MarkMurphy / README.md
Last active May 29, 2020
ActiveRecord: Store Milliseconds (or Microseconds) in Timestamps with Rails / MySQL
View README.md

ActiveRecord: Store Milliseconds (or Microseconds) in DateTimes or Timestamps with Rails / MySQL

Milliseconds in your DateTimes or Timestamps.

We got 'em, you want 'em.

NOTE: only MySQL 5.6.4 and above supports DATETIME's with more precision than a second. For reference see MySQL 5.6.4 Changelog

Why

Shit needs to be PRECISE

@MarkMurphy
MarkMurphy / README.md
Last active Jun 2, 2020
Rails resumable uploads
View README.md

Uploads large files in multiple chunks. Also has the ability to resume if the upload is interrupted.

Typical usage:

  1. Send a POST request to /upload with the first chunk of the file and receive an upload id in return.
  2. Repeatedly PATCH subsequent chunks using the upload id to identify the upload in progress and an offset representing the number of bytes transferred so far.
  3. After each chunk has been uploaded, the server returns a new offset representing the total amount transferred.
  4. After the last chunk commit the upload by passing its id to another endpoint such as POST /upload/commit/:id:
You can’t perform that action at this time.