Skip to content

Instantly share code, notes, and snippets.

Dem Pilafian dpilafian

Block or report user

Report or block dpilafian

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
@dpilafian
dpilafian / toSalesforceId18.groovy
Last active Feb 11, 2019
Groovy function to convert a Salesforce id15 to id18
View toSalesforceId18.groovy
def toSalesforceId18(String id) {
// Converts a Salesforce id15 to id18.
// Example:
// assert toSalesforceId18("001C000000o4Ooi") == "001C000000o4OoiIAE"
// Details:
// https://blog.centerkey.com/2014/08/groovy-convert-salesforce-id15-id18.html
// MIT License (c) 2019 Pilafian
def valueToCode = { ((it < 26 ? "A" : "0") as char) + it % 26 }
def binaryToCode = { valueToCode(Integer.parseInt(it, 2)) as char }
def tripletToBinary = { it.reverse().replaceAll(/[^A-Z]/, "0").replaceAll(/[^0]/, "1") }
@dpilafian
dpilafian / tree.sh
Last active Feb 5, 2019
Unix/Linux Folder Tree
View tree.sh
#!/bin/bash
#####################################################
# Unix/Linux Folder Tree #
# Version: 2.8 #
# File: ~/apps/tree/tree.sh #
# #
# Displays structure of folder hierarchy #
# ------------------------------------------------- #
# This tiny script uses "ls", "grep", and "sed" #
# in a single command to show the nesting of #
@dpilafian
dpilafian / folder-listing.php
Last active Sep 21, 2019
Replacement for Apache DirectoryIndex
View folder-listing.php
<!doctype html>
<!-- - - - - - - - - -->
<!-- Folder Listing -->
<!-- - - - - - - - - -->
<!-- Example page: https://centerkey.com/files -->
<html lang=en>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name=apple-mobile-web-app-title content="Folder">
View add-app-to-path.sh
#!/bin/bash
###################
# add-app-to-path #
###################
# https://gist.github.com/dpilafian/2ca6c58efa050ae2b2fa1810a6850fc0
# WTFPL
#
# Pass in the name of the app, such as: "ant", "mongo", or "groovy". If
# the app is not on the path, its "bin" folder will be added to the path.
@dpilafian
dpilafian / mongodb-start.sh.command
Last active Feb 18, 2019
Quickly stand up of a local instance of MongoDB for development (without installing anything)
View mongodb-start.sh.command
#!/bin/bash
#################
# Start MongoDB #
#################
# Quickly stand up of a local instance of MongoDB for development (without installing anything)
#
# https://gist.github.com/dpilafian/b07722347bb296cb6f3b6c300869d256
#
# Setup:
@dpilafian
dpilafian / web-baseline.html
Last active Apr 24, 2019
Web baseline HTML
View web-baseline.html
<!doctype html>
<!-- - - - - - - - -->
<!-- Website info -->
<!-- - - - - - - - -->
<html lang=en>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name=apple-mobile-web-app-title content="[SHORT-TITLE]">
<meta name=twitter:card content="summary_large_image">
@dpilafian
dpilafian / task-runner.sh.command
Last active Feb 27, 2019
Shell functions to support running project tasks
View task-runner.sh.command
#!/bin/bash
###############
# Task Runner #
###############
# To make this file runnable:
# $ chmod +x *.sh.command
banner="Task Runner"
projectHome=$(cd $(dirname $0); pwd)
@dpilafian
dpilafian / perfect.css
Last active Apr 24, 2019
Feedback form
View perfect.css
/* PERFECT PHP - centerkey.com/php - MIT or WTFPL (your choice) */
/* PERFECT style */
form.perfect { max-width: 25em; background-color: whitesmoke; color: dimgray; border: 1px solid; border-radius: 2px; padding: 20px; margin: 0px auto 20px auto; }
form.perfect h2 { font-size: 1.2rem; text-align: center; color: white; padding: 0.3em; margin: -20px -20px 20px -20px; clear: none; }
form.perfect fieldset { border: none; padding: 0px; margin: 0px; }
form.perfect label { display: block; text-align: left; }
form.perfect input:not([type=checkbox]):not([type=radio]), form.perfect textarea { width: 100%; max-width: 100%; font-size: 1.2rem; margin: 0px 0px 15px 0px; -webkit-appearance: none; }
form.perfect input[type=checkbox], form.perfect input[type=radio] { font-size: 1.2rem; margin: 0px 0.5em 0.2em 1.5em; }
form.perfect label:last-of-type input { margin-bottom: 20px; }
You can’t perform that action at this time.