Skip to content

Instantly share code, notes, and snippets.

View gist:eae372b0f80ad8a11cff
def layout
root :my_root do
add UIButton, :button_1 do
constraints do
width 30
height 144
dmoss18 / gist:badb89c7f6228bc1a0ad
Last active August 29, 2015 14:05
Custom motionkit view and layout
View gist:badb89c7f6228bc1a0ad
class MyCustomView < UIView
def top_title=(value)
@top_title = value
#Custom code here
class MyCustomLayout < MK::Layout
View index.html
<!DOCTYPE html>
<script src=""></script>
<script src=""></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.box {
width: 100px;

Keybase proof

I hereby claim:

  • I am dmoss18 on github.
  • I am dmoss18 ( on keybase.
  • I have a public key whose fingerprint is CEF4 C443 240F 1B7B 1B6C 0ACA 8126 A81D 29C8 4773

To claim this, I am signing this object:

dmoss18 / updateField.js
Last active July 2, 2018 18:25
Better pattern for updating model
View updateField.js
// This way is needlessly verbose
export default class CustomerNameComponent {
customer = new Customer()
// Annoying boilerplate
updateCustomerName = (text: string) => { = text
render() {
View validateDatetime.js
import { parsePhoneNumber } from 'libphonenumber-js'
import { validate, isString } from 'validate.js'
import * as REGEX_PATTERNS from './regex/constants'
import moment from 'moment'
// tslint:disable:no-unsafe-any
export const PHONE_NUMBER = (value: string) => {
const errorMessage = 'is invalid'
if (!!value && isString(value)) {
try {
View gist:271251c778fbbc413285113d25205430
<grid.column width="0.25" />
<grid.column width="0.25" />
<grid.column width="0.5" />
<grid.Row Height="20px" />
<Label1 Grid.Column="0" Grid.Row="0" Text="Colum1, Row1" />
dmoss18 / CountdownLabel.xaml.cs
Created July 25, 2019 13:47
Label that renders a countdown timer
View CountdownLabel.xaml.cs
using System;
using Xamarin.Forms;
namespace DK.InstantBetting.Views
public partial class CountdownLabel : Label
public static readonly BindableProperty TargetTimeProperty =
BindableProperty.Create("TargetTime", typeof(DateTime), typeof(CountdownLabel), DateTime.Now, propertyChanged: TargetTimeChanged);
View keyed-statistic-renderer.ts
export type KeyedStatisticRenderer = { key: string, render: StatisticRenderer }
export function keyedRenderer(key: string, renderer: StatisticRenderer): KeyedStatisticRenderer { return { key, render: renderer } }
const WatchlistStatisticRenderers = {
[WatchlistColumn.EstimatedEarnings]: keyedRenderer('watchlist-estimated-earnings', createStatisticFieldRenderer(() => 0))
[WatchlistColumn.Range]: keyedRenderer('watchlist-range', RangeFieldRenderer)
<AnimatedSyncedHorizontalScrollView offsetObserver={this.props.offsetObserver} style={} onPress={this.props.onPress}>
dmoss18 / ale_topic.ex
Created April 29, 2021 15:41
Ale topic mappings to our back-end services
View ale_topic.ex
defmodule Apex.AleTopic do
@moduledoc """
Utility functions for working with ALE topics.
alias __MODULE__
@enforce_keys [:name, :apex_api, :api_endpoint]
defstruct name: nil, apex_api: nil, api_endpoint: nil, base_url: Apex.Config.api_host, partition: Apex.Config.partition