Last active
April 20, 2018 17:23
-
-
Save lepinekong/8ed36d43b7888625fd856e0c7ed68f28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$demo="JsonResume";$github='https://gist.github.com/lepinekong/8ed36d43b7888625fd856e0c7ed68f28';$demofolder="C:\red\demos\$demo";Add-Type -AssemblyName Microsoft.VisualBasic;$demofolder=[Microsoft.VisualBasic.Interaction]::InputBox("Enter folder for $demo demo:", $demo, $demofolder);if ($demofolder -ne $null) {$exefolder="C:\red";$demo=Split-Path $demofolder -Leaf;[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;$WebResponse = Invoke-WebRequest -Uri "$github";$links=$WebResponse.Links | Select href | Where-Object {$_.href -match 'JsonResume.red'};$link=$links[0].href;$src="https://gist.githubusercontent.com$link";$exeurl='https://static.red-lang.org/dl/win/red-063.exe';New-Item -ItemType Directory -Force -Path $red-folder;New-Item -ItemType Directory -Force -Path $demofolder;New-Item -ItemType Directory -Force -Path "$demofolder";$Webcli=New-Object System.Net.WebClient;if (!(Test-Path `"$exefolder\red.exe`")) {$Webcli.DownloadFile("$exeurl","$exefolder\red.exe")};"Red [] `n print to-local-file what-dir `n do read $src" | Out-File -filepath "$demofolder\$demo.red" -Encoding "UTF8";"start `"%~n0`" `"$exefolder\red.exe`" `"$demofolder\%~n0.red`" %1" | Out-File -filepath "$demofolder\$demo.bat" -Encoding ASCII;cmd.exe /c "$demofolder\$demo.bat";Add-Type -AssemblyName PresentationFramework;$msgBox=[System.Windows.MessageBox]::Show('Would you like to download the source?','Download','YesNo','Question');switch ($msgBox) {'Yes' {$links=$WebResponse.Links | Select href | Where-Object {$_.href -match 'JsonResume.red'};$link=$links[0].href;$Webcli.DownloadFile("https://gist.githubusercontent.com$link","$demofolder\$demo.red");$links=$WebResponse.Links | Select href | Where-Object {$_.href -match '.JsonResume.deploy.ps1'};$link=$links[0].href;$Webcli.DownloadFile("https://gist.githubusercontent.com$link","$demofolder\JsonResume.deploy.ps1");$links=$WebResponse.Links | Select href | Where-Object {$_.href -match 'JsonResume.deploy.red'};$link=$links[0].href;$Webcli.DownloadFile("https://gist.githubusercontent.com$link","$demofolder\JsonResume.deploy.red")} 'No' {}};start explorer.exe -ArgumentList "/select, `"$demofolder\$demo.red`""} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "JsonResume.deploy.red" | |
Description: {This script will generate JsonResume.deploy.ps1 | |
the Zero Install Oneliner Powershell Script} | |
Urls: [ | |
https://mcpmag.com/articles/2013/01/22/pshell-invoke-webrequest.aspx | |
https://www.jaapbrasser.com/quicktip-select-all-links-using-invoke-webrequest/ | |
] | |
] | |
;=========================================================================================== | |
; PREAMBLE | |
;=========================================================================================== | |
; loading library | |
REMOTE-LIB: false | |
unless ((REMOTE-LIB = false) and (exists? lib: %.system.user.apps.authoring.library.red)) [ | |
print "Loading remote lib" | |
do read https://gist.githubusercontent.com/lepinekong/7574892bfefe7e53e7bd4dd4759f30f8/raw/2dec6c1f92fe1834632d998ffb831539caa23d63/.github.lib.red | |
github-url-entry: https://gist.github.com/lepinekong/7574892bfefe7e53e7bd4dd4759f30f8 | |
lib: get-github-url github-url-entry %.system.user.apps.authoring.library.red | |
] | |
do read lib | |
;self script path | |
script-path: system/options/script | |
short-filename: .get-short-filename/wo-extension script-path | |
;=========================================================================================== | |
; DATA | |
;=========================================================================================== | |
template: [ | |
source: { | |
$demo="JsonResume" | |
$github='https://gist.github.com/lepinekong/b59fa3e8d386dea1ebaa1a096488c542' | |
$demofolder="C:\red\demos\$demo" | |
Add-Type -AssemblyName Microsoft.VisualBasic | |
$demofolder=[Microsoft.VisualBasic.Interaction]::InputBox("Enter folder for $demo demo:", $demo, $demofolder) | |
if ($demofolder -ne $null) {$exefolder="C:\red" | |
$demo=Split-Path $demofolder -Leaf | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
$WebResponse = Invoke-WebRequest -Uri "$github" | |
$links=$WebResponse.Links | Select href | Where-Object {$_.href -match 'JsonResume.red'} | |
$link=$links[0].href | |
$src="https://gist.githubusercontent.com$link" | |
$exeurl='https://static.red-lang.org/dl/win/red-063.exe' | |
New-Item -ItemType Directory -Force -Path $red-folder | |
New-Item -ItemType Directory -Force -Path $demofolder | |
New-Item -ItemType Directory -Force -Path "$demofolder" | |
$Webcli=New-Object System.Net.WebClient | |
if (!(Test-Path `"$exefolder\red.exe`")) {$Webcli.DownloadFile("$exeurl","$exefolder\red.exe")} | |
"Red [] `n print to-local-file what-dir `n do read $src" | Out-File -filepath "$demofolder\$demo.red" -Encoding "UTF8" | |
"start `"%~n0`" `"$exefolder\red.exe`" `"$demofolder\%~n0.red`" %1" | Out-File -filepath "$demofolder\$demo.bat" -Encoding ASCII | |
cmd.exe /c "$demofolder\$demo.bat" | |
Add-Type -AssemblyName PresentationFramework | |
$msgBox=[System.Windows.MessageBox]::Show('Would you like to download the source?','Download','YesNo','Question') | |
switch ($msgBox) {'Yes' {$links=$WebResponse.Links | Select href | Where-Object {$_.href -match 'JsonResume.red'} | |
$link=$links[0].href | |
$Webcli.DownloadFile("https://gist.githubusercontent.com$link","$demofolder\$demo.red") | |
$links=$WebResponse.Links | Select href | Where-Object {$_.href -match '.JsonResume.deploy.ps1'} | |
$link=$links[0].href | |
$Webcli.DownloadFile("https://gist.githubusercontent.com$link","$demofolder\JsonResume.deploy.ps1") | |
$links=$WebResponse.Links | Select href | Where-Object {$_.href -match 'JsonResume.deploy.red'} | |
$link=$links[0].href | |
$Webcli.DownloadFile("https://gist.githubusercontent.com$link","$demofolder\JsonResume.deploy.red")} 'No' {}} | |
start explorer.exe -ArgumentList "/select, `"$demofolder\$demo.red`""} | |
} | |
] | |
;=========================================================================================== | |
; PROGRAM | |
;=========================================================================================== | |
out: copy "" | |
source: .select template 'source | |
block: .read/lines source | |
forall block [ | |
element: trim/head/tail block/1 | |
unless (element = "") [ | |
append out element | |
unless (tail? next next block) [append out ";"] | |
back back block | |
] | |
] | |
out-file: .to-file [short-filename ".ps1"] | |
write out-file out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "An identifier for the schema version (currently '1'). If there are future updates to the schema, then ResumeFodder can use this field to recognize outdated files and warn you about it.", | |
"basics": { | |
"name": "Your first and last name", | |
"label": "", | |
"picture": "", | |
"email": "Your email address", | |
"phone": "A phone number, with any formatting you like. E.g. (555) 555-5555.", | |
"degree": "", | |
"website": "Your website URL", | |
"summary": "A one-sentence to one-paragraph overview text. Do not include any line-breaks.", | |
"highlights": ["Bullet-point list items that you would like to include along with (or instead of) a summary paragraph."], | |
"location": { | |
"address": "Your street address or mailing address", | |
"postalCode": "Your postal code (ZIP in the U.S.)", | |
"city": "Your city", | |
"countryCode": "Your country (e.g. USA)", | |
"region": "Your region (state in the U.S.)" | |
}, | |
"profiles": [{ | |
"network": "A social media or other profile that you would like to include (e.g. LinkedIn, Twitter)", | |
"username": "Your username on this network", | |
"url": "A URL to your user profile page" | |
}] | |
}, | |
"work": [{ | |
"company": "Your employer name", | |
"position": "Your job title", | |
"website": "The URL for the employer's website", | |
"startDate": "Your start date, in YYYY-MM-DD format", | |
"endDate": "Your end date, in YYY-MM-DD format (leave blank for a current position)", | |
"summary": "A one-sentence to one-paragraph summary of this employer or position", | |
"highlights": ["Bullet-point list items that you would like to include along with (or instead of) a summary paragraph."] | |
}], | |
"additionalWork": [{ | |
"company": "Job history that you would like to group separately (e.g. old jobs, academic positions, etc)", | |
"position": "All fields under the section are the same as for 'work'", | |
"website": "", | |
"startDate": "", | |
"endDate": "", | |
"summary": "", | |
"highlights": ["Templates typically omit highlights for 'additionalWork' positions"] | |
}], | |
"workLabel": "Overrides the template label for the 'work' section (e.g. 'Recent Experience')", | |
"additionalWorkLabel": "Overrides the template label for the 'additionalWork' section (e.g. 'Prior Experience')", | |
"education": [{ | |
"institution": "Your school name", | |
"area": "Your area of study or degree earned", | |
"studyType": "", | |
"startDate": "Your start date, in YYYY-MM-DD format", | |
"endDate": "Your completion date, in YYYY-MM-DD format", | |
"gpa": "", | |
"courses": [""] | |
}], | |
"publications": [{ | |
"name": "Your publication title", | |
"publisher": "Publisher name", | |
"releaseDate": "Publication date, in YYYY-MM-DD format", | |
"website": "The website URL for this publisher or book", | |
"summary": "A one-sentence to one-paragraph overview of this publication", | |
"isbn": "The ISBN of this publication" | |
}], | |
"additionalPublications": [{ | |
"name": "Publications that you would like to group separately (e.g. editor rather than author, academic publications, etc)", | |
"publisher": "All fields under this section are the same as for 'publications'", | |
"releaseDate": "", | |
"website": "", | |
"summary": "", | |
"isbn": "" | |
}], | |
"publicationsLabel": "Overrides the template label for the 'publications' section (e.g. 'Publications (Author)')", | |
"additionalPublicationsLabel": "Overrides the template label for the 'additionalPublications' section (e.g. 'Publications (Technical Reviewer)')", | |
"skills": [{ | |
"name": "A category of job skills (e.g. 'Programming Languages')", | |
"level": "", | |
"keywords": ["Keywords under this category (e.g. 'Java', 'C++', etc)"] | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comment { | |
Redlang: https://red-lang.org | |
Tutorials: [ | |
https://dev.to/lepinekong/red-for-hopeless-programmers---part-i-3g0 | |
https://dev.to/lepinekong/red-for-hopeless-programmers---part-ii-258 | |
] | |
Demo-Instruction: { | |
Just paste the content of .ReAdABLE.HumanFormat.deploy.ps1 in Powershell at: | |
https://gist.github.com/lepinekong/b59fa3e8d386dea1ebaa1a096488c542 | |
It will install Red and the source of the Article, the markdown and a batch file to re-execute it. | |
} | |
Source-Url: https://gist.github.com/lepinekong/b59fa3e8d386dea1ebaa1a096488c542 | |
Demo-Url: https://medium.com/@lepinekong/readable-human-format-md-8fda1869ef75 | |
} | |
Red [ | |
Title: "JsonResume.red" | |
Description: {Write your Resume in cleaner ReAdABLE Human Format then convert to Json Resume} | |
Infos: [ | |
ReAdABLE-Human-Format: https://medium.com/@lepinekong/readable-human-format-md-8fda1869ef75 | |
JsonResume-Format: [ | |
https://jsonresume.org/ | |
https://resumefodder.com/docs/jsonresume.html | |
] | |
] | |
] | |
;=========================================================================================== | |
; PREAMBLE | |
;=========================================================================================== | |
; loading library | |
REMOTE-LIB: false | |
unless ((REMOTE-LIB = false) and (exists? lib: %.system.user.apps.authoring.library.red)) [ | |
print "Loading remote lib" | |
do read https://gist.githubusercontent.com/lepinekong/7574892bfefe7e53e7bd4dd4759f30f8/raw/2dec6c1f92fe1834632d998ffb831539caa23d63/.github.lib.red | |
github-url-entry: https://gist.github.com/lepinekong/7574892bfefe7e53e7bd4dd4759f30f8 | |
lib: get-github-url github-url-entry %.system.user.apps.authoring.library.red | |
] | |
do read lib | |
;self script path | |
script-path: system/options/script | |
short-filename: .get-short-filename/wo-extension script-path | |
;=========================================================================================== | |
; DATA | |
;=========================================================================================== | |
; don't forget to toggle word-wrap in VSCode | |
; dont forget to install VSCode Beautify Extension for Json | |
; to convert to json see program below json-gen | |
; the JsonResume below was automatically converted by copying into clipboard | |
; the Json Template on https://resumefodder.com/docs/jsonresume.html | |
; by typing a single command: | |
; to-readable | |
; and then pasting the result below after JsonResume: | |
JsonResume: [ | |
version: {An identifier for the schema version (currently '1'). If there are future updates to the schema, then ResumeFodder can use this field to recognize outdated files and warn you about it.} | |
basics: [ | |
name: "Your first and last name" | |
label: "" | |
picture: "" | |
email: "Your email address" | |
phone: {A phone number, with any formatting you like. E.g. (555) 555-5555.} | |
degree: "" | |
website: "Your website URL" | |
summary: {A one-sentence to one-paragraph overview text. Do not include any line-breaks.} | |
highlights: [ | |
{Bullet-point list items that you would like to include along with (or instead of) a summary paragraph.} | |
] | |
location: [ | |
address: "Your street address or mailing address" | |
postalCode: "Your postal code (ZIP in the U.S.)" | |
city: "Your city" | |
countryCode: "Your country (e.g. USA)" | |
region: "Your region (state in the U.S.)" | |
] | |
profiles: [ | |
[ | |
network: {A social media or other profile that you would like to include (e.g. LinkedIn, Twitter)} | |
username: "Your username on this network" | |
url: "A URL to your user profile page" | |
] | |
] | |
] | |
work: [ | |
[ | |
company: "Your employer name" | |
position: "Your job title" | |
website: "The URL for the employer's website" | |
startDate: "Your start date, in YYYY-MM-DD format" | |
endDate: {Your end date, in YYY-MM-DD format (leave blank for a current position)} | |
summary: {A one-sentence to one-paragraph summary of this employer or position} | |
highlights: [ | |
{Bullet-point list items that you would like to include along with (or instead of) a summary paragraph.} | |
] | |
] | |
] | |
additionalWork: [ | |
[ | |
company: {Job history that you would like to group separately (e.g. old jobs, academic positions, etc)} | |
position: {All fields under the section are the same as for 'work'} | |
website: "" | |
startDate: "" | |
endDate: "" | |
summary: "" | |
highlights: [ | |
{Templates typically omit highlights for 'additionalWork' positions} | |
] | |
] | |
] | |
workLabel: {Overrides the template label for the 'work' section (e.g. 'Recent Experience')} | |
additionalWorkLabel: {Overrides the template label for the 'additionalWork' section (e.g. 'Prior Experience')} | |
education: [ | |
[ | |
institution: "Your school name" | |
area: "Your area of study or degree earned" | |
studyType: "" | |
startDate: "Your start date, in YYYY-MM-DD format" | |
endDate: "Your completion date, in YYYY-MM-DD format" | |
gpa: "" | |
courses: [ | |
"" | |
] | |
] | |
] | |
publications: [ | |
[ | |
name: "Your publication title" | |
publisher: "Publisher name" | |
releaseDate: "Publication date, in YYYY-MM-DD format" | |
website: "The website URL for this publisher or book" | |
summary: {A one-sentence to one-paragraph overview of this publication} | |
isbn: "The ISBN of this publication" | |
] | |
] | |
additionalPublications: [ | |
[ | |
name: {Publications that you would like to group separately (e.g. editor rather than author, academic publications, etc)} | |
publisher: {All fields under this section are the same as for 'publications'} | |
releaseDate: "" | |
website: "" | |
summary: "" | |
isbn: "" | |
] | |
] | |
publicationsLabel: {Overrides the template label for the 'publications' section (e.g. 'Publications (Author)')} | |
additionalPublicationsLabel: {Overrides the template label for the 'additionalPublications' section (e.g. 'Publications (Technical Reviewer)')} | |
skills: [ | |
[ | |
name: {A category of job skills (e.g. 'Programming Languages')} | |
level: "" | |
keywords: [ | |
{Keywords under this category (e.g. 'Java', 'C++', etc)} | |
] | |
] | |
] | |
] | |
;=========================================================================================== | |
; PROGRAM | |
;=========================================================================================== | |
json-gen: function[][ | |
print "executing..." | |
json-file: .to-file reduce [short-filename ".json"] ; example: %JsonResume.json | |
json-resume: .to-json JsonResume | |
write json-file json-resume | |
] | |
json-gen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment