Skip to content

Instantly share code, notes, and snippets.

View steveliles's full-sized avatar

Steve Liles steveliles

View GitHub Profile
@steveliles
steveliles / Foreground.java
Last active July 21, 2016 07:50
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
/**
* Copyright 2015 Steve Liles
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@steveliles
steveliles / react-numerals-test.md
Last active May 9, 2017 10:44
Javascript developer, technical test

Technical Test - React Developer

Test Part I

The numeric system represented by Roman numerals originated in ancient Rome and remained the usual way of writing numbers throughout Europe well into the Late Middle Ages. Numbers in this system are represented by combinations of letters from the Latin alphabet. Roman numerals, as used today, are based on seven symbols:

| Symbol | I | V | X | L | C | D | M | | --------------------------------------------| | Value | 1 | 5 | 10 | 50 | 100 | 500 | 1000 |

@steveliles
steveliles / mentions-with-draft.js
Created September 20, 2017 12:47
Implementing @Mention's in Draft.js
const { Editor, EditorState, CompositeDecorator, Modifier, SelectionState } = Draft;
const getMentionPosition = () => {
const range = window.getSelection().getRangeAt(0).cloneRange();
const rect = range.getBoundingClientRect();
return { top: rect.bottom, left: rect.left }
}
const getCaretPosition = (editorState) => {
return editorState.getSelection().getAnchorOffset()
image: node:9.3.0
pipelines:
branches:
production:
- step:
caches:
- node
script:
# build and test the app
image: my-docker-hub/my-pipeline-container
options:
docker: true
pipelines:
branches:
production:
- step:
caches:
@steveliles
steveliles / embed.jsx
Created February 12, 2018 17:14
embedly with react.js
import React, {Component} from 'react'
import { connect } from 'react-redux'
// one-time init of the embedly platform.js, hidden behind
// typeof check not to blow up on server-side render
if (typeof window !== 'undefined') {
let init_embedly = function(w,d){
var id='embedly-platform', n = 'script';
if (!d.getElementById(id)){
w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);};