Skip to content

Instantly share code, notes, and snippets.

@bzerangue
bzerangue / data.csv
Created Dec 24, 2020 — forked from Monichre/data.csv
Demo of importing a CSV file into a Contentful space
View data.csv
first name last name age
Stephen Sugden 31
Tom Reznik 29
Justin Thomas 30
@bzerangue
bzerangue / BulkRename.applescript
Created Dec 5, 2020 — forked from nrollr/BulkRename.applescript
Bulk rename files with csv file
View BulkRename.applescript
-- Store the .csv file in the same directory as the files you wish to rename
-- Replace 'username' in the path with your own (lines 3 & 10)
set csvFile to "/Users/username/Documents/index.csv"
set csvList to paragraphs of (read csvFile)
set {theID, my text item delimiters} to {my text item delimiters, ","}
repeat with csvLines in csvList
set {oldName, newName} to text items of csvLines
tell application "System Events"
set name of file oldName of folder "/Users/username/Documents/" to newName
@bzerangue
bzerangue / videoEmbed.js
Last active Mar 19, 2021
videoEmbed.js contentType - preview component for Sanity.io CMS richText PortableText editor - based off of Knut's YouTube Preview, https://www.youtube.com/watch?v=kLsER_zHiS4
View videoEmbed.js
import React from 'react'
const VideoEmbedPreview = ({ value }) => {
const url = value.url
const responsiveVideoContainer = {
padding: "56.25% 0 0 0",
position: "relative"
}
@bzerangue
bzerangue / x86-raspi-screenly-ose.md
Last active Feb 15, 2021
Running Screenly OSE on Raspberry Pi Desktop for x86 (PC) - instructions [this is not supported - this is a hack to get it to work]
View x86-raspi-screenly-ose.md

NOTE: These are not official instructions for the getting Screenly OSE to run on Raspberry Pi Desktop for x86 machines. This was a hack. These instructions are not supported. I posted them here to remember the steps I took to get it to work. Use at your own risk.

Step 1

  • Load Wifi deb files onto USB
  • Install Raspberry Pi Desktop for x86 PC - Raspberry Pi Debian Stretch - 2019-04-11-rpd-x86-stretch.iso

Step 2

View error.txt
Error: Cannot find module './cors/addCorsOriginCommand'
Require stack:
- /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/eleventyboilerplate/node_modules/@sanity/core/lib/commands/index.js
- /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/eleventyboilerplate/node_modules/@sanity/core/lib/index.js
- /usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js
- /usr/local/lib/node_modules/@sanity/cli/bin/sanity
at require (/usr/local/lib/node_modules/@sanity/cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (~/Dev/sanity/eleventy-sanity-blog-boilerplate/eleventyboilerplate/node_modules/@sanity/core/lib/commands/index.js:64:52)
at Module._compile (/usr/local/lib/node_modules/@sanity/cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
@bzerangue
bzerangue / a_README.md
Last active Jun 10, 2019
Migrating Symphony CMS REST API data to Sanity.io
View a_README.md

Migrating Symphony CMS REST API data to Sanity.io

Note: Using jq to transform JSON data.

  1. Original Data from the REST API extension in Symphony CMS --> example-01.json

  2. Clean-up original json data with jq from the command-line. --> example-02.json (cleaner JSON data)

cat example-01.json | jq '[.response.entry[] | {_type: "sermons", title: .title.value, date: .date.date.start._iso, scripture: .scripture.value, speaker: .["speaker-name"].value,audio: .["simplecast-url"].value}]' > example-02.json
View json-to-ndjson.md

NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.

  • Each line is a valid JSON value
  • Line separator is ‘\n’

1. Convert JSON to NDJSON?

cat test.json | jq -c '.[]' > testNDJSON.json
@bzerangue
bzerangue / function_RecursiveArraySearch.php
Last active Dec 13, 2018
PHP: Recursive Array Search Function
View function_RecursiveArraySearch.php
<?php
/*
=====
Find integer value of array key for search term in the $needle.
=====
*/
function recursive_array_search($needle,$haystack) {
@bzerangue
bzerangue / index.html
Created Oct 10, 2018
VueJS Audio Player V2!
View index.html
<div id="app">
<div class="heading">
<h1>VueJS Audio Player V2</h1>
<p>(photos from <a href="https://unsplash.com/">unsplash</a> &amp; audios from <a href="https://soundbible.com/">soundbible</a>)</p>
</div>
<div class="audioContainer">
<a class="nav-icon" v-on:click="isPlaylistActive=!isPlaylistActive" :class="{'isActive': isPlaylistActive}" title="Music List">
<span></span>
View master.xml
<?xml version="1.0" encoding="UTF-8"?>
<data rootUrl="https://static.pcpc.org" path="/audio/union/" folder="union">
<files>
<entry order="01">
<title>Meaning of Marriage</title>
<speaker>Paul Goebel</speaker>
<audio file="01__UNION__Meaning-of-Marriage__Paul_Goebel.mp3">https://static.pcpc.org/audio/union/01__UNION__Meaning-of-Marriage__Paul_Goebel.mp3</audio>
</entry>
<entry order="02">
<title>Leaving and Cleaving and In-Laws</title>