Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
brb

Pete petekp

💭
brb
View GitHub Profile
@petekp
petekp / textToJson.js
Last active Aug 29, 2020
Convert delimited .txt to .json
View textToJson.js
var fs = require('fs')
const jsonifyText = text => {
const cleaned = text
.toString()
.split("\n")
.filter(Boolean)
.map(item => item.split(/:(.+)/).filter(Boolean))
const structured = {
@petekp
petekp / Button.tsx
Created Jul 19, 2019
Substrate Themed Button Example
View Button.tsx
import * as React from 'react'
import {
TouchableOpacity,
StyleProp,
TouchableOpacityProps,
TextStyle,
Text,
} from 'react-native'
import { ThemedComponentLocked } from '../../typings'
@petekp
petekp / tsconfig.json
Created Mar 14, 2019
tsconfig.json for npm react component lib
View tsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"baseUrl": "src",
"declaration": true,
"jsx": "react",
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
@petekp
petekp / build.ts
Last active Jan 9, 2019
Node build script for creating distributable multi-format themes with Theo
View build.ts
import chalk from 'chalk'
import * as path from 'path'
import * as rimraf from 'rimraf'
import { promisify } from 'util'
import { flattenDeep } from 'lodash'
import { exec } from 'child_process'
import { upperFirst, camelCase } from 'lodash'
import { promises as fsPromise, lstatSync, readdirSync } from 'fs'
import { Format, Transform, TheoConfig } from '../typings/theo'
View theme.d.ts
export declare const Theme: {
zIndex: {
alert: number
dialog: number
mesosphere: number
modal: number
navigationBar: number
popover: number
root: number
stratosphere: number
@petekp
petekp / cloudSettings
Last active Oct 15, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-10-15T22:18:01.816Z","extensionVersion":"v3.4.3"}
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@petekp
petekp / taggify.js
Last active Oct 18, 2015
Wrap all characters in a string with any XHTML tag (ES6, lodash)
View taggify.js
taggify(string, tag) {
let taggedChars = []
_.map(string, function(char) {
taggedChars.push(`<${tag}>${char}</${tag}>`)
})
return taggedChars.join('')
}
@petekp
petekp / index.html
Created Oct 13, 2012
For my portfolio I wanted a grid of thumbnails that scaleZ on hover, overlapping their siblings. Added some blur and some scaling effect to the thumb title to create a neat depth effect. Still tweaking for mobile and non-Chrome browsers.
View index.html
<a href="#" class="thumbnail green"><div class="photo"><img src="http://www.photographyblogger.net/wp-content/uploads/2011/02/0410.jpg"></div><span class="title">Thumb Title</span></a>
<a href="#" class="thumbnail blue"><div class="photo"><img src="http://25.media.tumblr.com/tumblr_m4zl640xqN1rxrpico2_1280.jpg"></div><span class="title">Thumb Title</span></a>
<a href="#" class="thumbnail red"><div class="photo"><img src="http://3.bp.blogspot.com/-fZzVHhusP04/Ta-RoCMJW2I/AAAAAAAABxc/ehuIytZernY/s1600/FROGpoison-dart-frog_5869_600x450.jpg"></div><span class="title">Thumb Title</span></a>
<a href="#" class="thumbnail purple"><div class="photo"><img src="http://1.bp.blogspot.com/-_DbIIL07P6c/Ta-TQOMl0qI/AAAAAAAABxo/jSW1GbNfrj0/s1600/frog-picture.jpg"></div><span class="title">Thumb Title</span></a>
You can’t perform that action at this time.