Skip to content

Instantly share code, notes, and snippets.

View cwhittl's full-sized avatar
💭
Insert status here...

Chris Whittle cwhittl

💭
Insert status here...
View GitHub Profile
@cwhittl
cwhittl / fetch_plugin.js
Created April 13, 2017 14:42
Using Fetch with Wordpress Plugins Ajax
fetch(ajax_url, {
method: 'POST',
credentials: 'same-origin',
headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}),
body: 'action=zget_profile_user'
})
.then((resp) => resp.json())
.then(function(data) {
if(data.status == "success"){
_this.setState({loaded:true,user:data.user});
@cwhittl
cwhittl / Accordion.js
Created April 19, 2017 12:51
Simple React Component To Implement The Foundation Accordion Component missing from Foundation React
import React from 'react';
class Accordion extends React.Component {
render() {
return (
<ul className="accordion" data-accordion>{this.props.children}</ul>
);
}
}
export default Accordion;
@cwhittl
cwhittl / Code.gs
Last active July 25, 2018 17:13
Google Spreadsheet Convert to JSON
function doGet(e) {
var book = SpreadsheetApp.getActiveSpreadsheet();
var masterSheet = book.getSheetByName("New_072018");
// var json = convertSheet2Json(masterSheet);
var colStartIndex = 1;
var rowNum = 1;
var firstRange = masterSheet.getRange(1, 1, 1, masterSheet.getLastColumn());
var firstRowValues = firstRange.getValues();
var titleColumns = firstRowValues[0];
@cwhittl
cwhittl / media-uploader.hbs
Created January 28, 2019 14:32
Media Uploader using adopted-ember-addons/ember-file-upload
{{#file-dropzone name="media" as |dropzone queue|}}
{{#if dropzone.active}}
<div class='upload-modal {{if dropzone.valid "valid" "invalid"}}'>
{{#if dropzone.valid}}
Upload some stuff
{{else}}
<p>Sorry that file type can't be uploaded here</p>
{{/if}}
</div>
{{/if}}
@cwhittl
cwhittl / message.js
Created March 14, 2019 12:39
Bleno Gist
import bleno from 'bleno-mac';
class MessageCharacteristic extends bleno.Characteristic {
constructor(config) {
const props = Object.assign(config, {
uuid: '13333333-3333-3333-3333-800000000001',
properties: ['read', 'write', 'notify'],
value: null,
});
super(props);
@cwhittl
cwhittl / convert.sh
Last active March 12, 2024 18:11
Code to convert Supernotes stored in Dropbox
#!/bin/bash
#requires https://github.com/jya-dev/supernote-tool
superNotePath="/Users/chriswhittle/Dropbox/Supernote" #must be absolute if you are going to use cron
superNoteToolPath="/opt/homebrew/bin/supernote-tool" #must be absolute if you are going to use cron
superNoteNewExt="pdf"
find "${superNotePath}" -name "*.note" -print0 | while read -d $'\0' noteFile
do
convertedFile="${noteFile/Supernote/Supernote_Converted}"
convertedFile="${convertedFile%.*}.${superNoteNewExt}"
if [[ ! -f $convertedFile ]] || [[ $noteFile -nt $convertedFile ]] #make sure the converted file doesn't exist or the note is newer than last converted
@cwhittl
cwhittl / ObsidianConvert.sh
Created May 29, 2023 23:46
Super note to Obsidian
#!/bin/bash
superNotePath="/Users/chriswhittle/Dropbox/Supernote/Note"
superNoteToolPath="/opt/homebrew/bin/supernote-tool"
noteTakingAppPath="/Users/chriswhittle/Library/Mobile Documents/iCloud~md~obsidian/Documents/WhitsNotes"
pdfPath="/Users/chriswhittle/Library/Mobile Documents/iCloud~md~obsidian/Documents/WhitsNotes/SuperNote/pdf"
imagePath="/Users/chriswhittle/Library/Mobile Documents/iCloud~md~obsidian/Documents/WhitsNotes/SuperNote/images"
if [[ -d $pdfPath ]]
then
echo "Deleting Old Pdfs"
@cwhittl
cwhittl / ObisidianConvert.ps1
Created March 12, 2024 18:22
New Obsidian Convert
# Define the paths to the Supernote, Supernote Tool, and Obsidian directories
$dropBoxPath = "/Users/chris/Dropbox"
$obsidianVaultPath = "/Users/chris/Obsidian/WhitsNotesV6"
$superNotePath = "${dropBoxPath}/Supernote/Note"
$noteTakingAppPath = "${obsidianVaultPath}/_Inbox/"
$pdfPath = "${obsidianVaultPath}/zSupporting Files/Attachments/SuperNote/"
$superNoteToolPath = "/Library/Frameworks/Python.framework/Versions/3.12/bin/supernote-tool"
$returnLine = "`r`n"
# Delete the existing PDF and image directories if they exist
@cwhittl
cwhittl / supernoteconvert.ps1
Last active March 19, 2024 01:14
SuperNoteSyncWithNotebooksApp
# Define the paths to the Supernote, Supernote Tool, and Obsidian directories
$notesStoragePath = "/Users/chris/Dropbox"
$superNotePath = "${notesStoragePath}/Supernote/Note"
$notebooksAppStoragePath = "/Users/chris/Library/Mobile Documents/iCloud~com~aschmid~notebooks/Documents"
$inboxPath = "${notebooksAppStoragePath}/Inbox"
$pdfRelativePath = "/NBResources/Misc/SuperNoteImages"
$pdfPath = "${notebooksAppStoragePath}${pdfRelativePath}"
$superNoteToolPath = "/Library/Frameworks/Python.framework/Versions/3.12/bin/supernote-tool"
$returnLine = "`r`n"
@cwhittl
cwhittl / NotePlan-SuperNote-Import.ps1
Created June 18, 2024 15:23
This powershell script takes SuperNote (https://supernote.com/) notes and exports them in in the format needed by NotePlan (http://noteplan.co/). No matter where you move them it will update the PNGs of your Supernote notes
# Define the paths to the Supernote, Supernote Tool, and Obsidian directories
$superNoteParentStoragePath = "/Users/chris/Dropbox"
$superNotePath = "${superNoteParentStoragePath}/Supernote/Note"
$superNoteToolPath = "/Library/Frameworks/Python.framework/Versions/3.12/bin/supernote-tool"
$superNoteToolConversionType = "png"
$notesApplicationStoragePath = "/Users/chris/Library/Containers/co.noteplan.NotePlan3/Data/Library/Application Support/co.noteplan.NotePlan3/Notes"
$notesApplicationFileExt = ".txt"
$notesApplicationInboxPath = "${notesApplicationStoragePath}/0 - Inbox"
$notesApplicationAttachmentSuffix = "_attachments"