Skip to content

Instantly share code, notes, and snippets.

Steve Liles steveliles

Block or report user

Report or block steveliles

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
@steveliles
steveliles / embed.jsx
Created Feb 12, 2018
embedly with react.js
View embed.jsx
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);};
View ecs-pipelines.yml
image: my-docker-hub/my-pipeline-container
options:
docker: true
pipelines:
branches:
production:
- step:
caches:
View simple-javascript-pipeline.yml
image: node:9.3.0
pipelines:
branches:
production:
- step:
caches:
- node
script:
# build and test the app
@steveliles
steveliles / mentions-with-draft.js
Created Sep 20, 2017
Implementing @Mention's in Draft.js
View mentions-with-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()
@steveliles
steveliles / react-numerals-test.md
Last active May 9, 2017
Javascript developer, technical test
View react-numerals-test.md

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 / Foreground.java
Last active Jul 21, 2016
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
View Foreground.java
/**
* 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 / Foreground.java
Last active May 5, 2019
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
View Foreground.java
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@steveliles
steveliles / Foreground.java
Created Apr 20, 2014
Class for detecting and eventing the foreground/background state of an Android app - API-level 14+
View Foreground.java
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@steveliles
steveliles / VerticalViewPager.java
Last active Feb 26, 2019
A vertical-paging version of ViewPager - the existing implementations that I found did not work for me. This is a simple hack-up of the standard v4 support ViewPager to convert its horizontal behaviour to vertical.
View VerticalViewPager.java
package com.sjl.views;
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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
View CompatibleActivity.java
package androidconcurrency.chapter4;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
/**
* Adds support for isChangingConfigurations when minSdkVersion
* targets api-levels below 11.
*
* Unfortunately onSaveInstanceState is invoked AFTER onPause,
You can’t perform that action at this time.