Skip to content

Instantly share code, notes, and snippets.

View judismith's full-sized avatar

Judi Smith judismith

  • PJS Engineering
  • Phoenix
View GitHub Profile
@judismith
judismith / Parse_RSS_Feed.cs
Created April 29, 2024 01:31
Parse RSS Feed from Wordpress Blog
using System.ServiceModel.Syndication;
using System.Xml;
using System.Xml.Linq;
string url = "https://shaolinarts.com/feed/rss/";
XmlReader reader = XmlReader.Create(url);
SyndicationFeed feed = SyndicationFeed.Load(reader);
reader.Close();
foreach (SyndicationItem item in feed.Items)
@judismith
judismith / GetAllControlsOfType<T>
Created December 31, 2020 19:23
Xamarin : Get all the child controls of type<T> of a form by sending in the root control (ContentPage)
private static IList<T> GetAllControlsOfType<T>(Element view) where T : View
{
var rtn = new List<T>();
foreach (View item in view.Descendants())
{
var ctr = item as T;
if (ctr != null)
{
rtn.Add(ctr);
}
@judismith
judismith / GetParentControl.cs
Last active December 31, 2020 16:00
Xamarin : Method to find ascendant parent of type T of a control.
private static T GetParentControl<T>(View control) where T : SfTextInputLayout
{
if (control == null) return null;
var parent = control.Parent;
while (parent != null)
{
if (parent is T) return parent as T;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using MvvmCross.Plugins.Sqlite;
namespace ****.Repositories
{
public interface IRepository<T>
{
@judismith
judismith / PdDFPen-Pro-Reverse-Page-Order.scpt
Created January 30, 2018 16:08
Apple Script to reverse page order in PDFPen Pro
tell application "PDFpenPro"
tell document of front window
set totalPages to count of pages
set pageNo to totalPages - 1
repeat while pageNo ≥ 1
move page pageNo to page (totalPages + 1)
set pageNo to pageNo - 1
end repeat
end tell
end tell
@judismith
judismith / Folders to List.applescript
Created June 13, 2013 13:57
Name of subfolders to text file as list
tell application "Finder"
set AppleScript's text item delimiters to "
"
set myProjects to get name of folders of folder "Macintosh HD:Users:judis:Google Drive:Matters:" as text
set thePath to (path to documents folder as text) & "projects.csv"
set NewFile to open for access file thePath with write permission
write myProjects to NewFile as «class utf8»
close access NewFile
set AppleScript's text item delimiters to " "
myProjects
@judismith
judismith / New project from folder.applescript
Last active June 12, 2019 10:50
Script for use with Hazel to create a new project in OmniFocus when a new folder is created in the top level project folder. Apparently Hazel doesn't like it when you tinker with the variable "theFile" within the script. Also it seems that Hazel doesn't allow functions in the internal applescripts.
tell application "Finder"
-- set theFile to "Macintosh HD:Users:[username]:Google Drive:Matters:Test Folder:" -- For testing
set myFile to do shell script "basename " & (the quoted form of (the POSIX path of theFile))
-- check to see if it is worth starting OF
if myFile does not start with "_" and (theFile as string) ends with ":" then
set theDueDate to (current date) + 7 * days
@judismith
judismith / Prepend and Move.applescript
Created June 11, 2013 19:44
This script prepends the parent folder name and " - " to all the children folders. It them moves the children folders to the same level as the parent folder.
tell application "Finder"
set thePath to (path to desktop folder as text)
set clientFolders to get name of folders of folder thePath
repeat with theFolder in clientFolders
if the theFolder starts with "_" then exit repeat
set matterFolders to get folders of folder (thePath & theFolder as text)
repeat with aFolder in matterFolders
set clientName to theFolder as text
set the name of aFolder to theFolder & " - " & the name of aFolder
end repeat
@judismith
judismith / Folder List to Evernote.applescript
Created June 10, 2013 05:37
Gets the names of folders two levels deep. Puts the names in a list with the subfolders indented. I use this to keep a handy list of all of my clients and their matter numbers. I use the names and numbers in the titles of notes pertaining to the client. When I export the EN Notes with the Evernote to Marked script, the Hazel rule watching the ex…
tell application "Finder"
set folderList to ""
set mattersFolder to (((path to home folder as text) & "Google Drive:Matters:"))
set clientFolders to get name of folders of folder mattersFolder
repeat with theFolder in clientFolders
set folderList to folderList & theFolder & return
set thePath to mattersFolder & theFolder
set subFolders to get the name of folders of folder thePath
if (count of subFolders) is greater than 0 then
repeat with aFolder in subFolders
@judismith
judismith / Evernote to Marked.applescript
Last active December 18, 2015 07:29
Grab the contents of an Evernote note, run it through the shell to clean it up a bit, then send it on to Marky to get markdownified. Finally we write it to the base folder of Google Drive. The idea is to take notes on the go in EN, then upload them to Drive to share with the whole team.
tell application "Evernote"
if (not (tag named "exported" exists)) then
make tag with properties {name:"exported"}
end if
set matches to find notes "tag:etf"
repeat with theNote in matches
set myTitle to title of theNote
set myTags to tags of theNote
set tagList to ""
repeat with theTag in myTags