Skip to content

Instantly share code, notes, and snippets.

View defong's full-sized avatar
🎯
Focusing

De Fong defong

🎯
Focusing
View GitHub Profile
@defong
defong / DfE ttapi collection.json
Last active December 2, 2022 11:54
[DfE] Thunder Client
{"client":"Thunder Client","collectionName":"DfE ttapi","dateExported":"2022-12-01T14:44:21.609Z","version":"1.1","folders":[],"requests":[{"_id":"5c832b22-a335-4487-95ac-f5f86129a031","colId":"0888a3c5-e2ec-44f8-9621-1ea0cf4a1394","containerId":"","name":"Providers","url":"{{base_url_qa}}/{{api/public/v1}}/{{recruitment_cycles/2023}}/providers","method":"GET","sortNum":10000,"created":"2022-12-01T09:07:58.330Z","modified":"2022-12-01T14:44:08.715Z","headers":[],"params":[],"tests":[{"type":"set-env-var","custom":"","action":"setto","value":"{{server}}"}]},{"_id":"e1969d15-2d96-401b-8784-0e8c949008bd","colId":"0888a3c5-e2ec-44f8-9621-1ea0cf4a1394","containerId":"","name":"Provider","url":"{{base_url_qa}}/{{api/public/v1}}/{{recruitment_cycles/2023}}/providers/1BJ","method":"GET","sortNum":20000,"created":"2022-12-01T09:19:51.202Z","modified":"2022-12-01T14:42:39.057Z","headers":[],"params":[],"tests":[{"type":"set-env-var","custom":"","action":"setto","value":"{{server}}"}]},{"_id":"34bff35e-e669-4137-8d5e-99
@defong
defong / [DfE] accredited-body-courses-to-csv.rb
Last active July 21, 2022 09:54
[DfE] accredited-body-courses-to-csv.rb
ap = RecruitmentCycle.current.providers.find_by(provider_code: "E75")
nap = {
"1KM": RecruitmentCycle.current.providers.find_by( provider_code: "M82"),
"1K8": RecruitmentCycle.current.providers.find_by( provider_code: "E69"),
"3H5": RecruitmentCycle.current.providers.find_by( provider_code: "E69"),
"285": RecruitmentCycle.current.providers.find_by( provider_code: "F82"),
"1ZH": RecruitmentCycle.current.providers.find_by( provider_code: "F82"),
"2G1": RecruitmentCycle.current.providers.find_by( provider_code: "F82"),
@defong
defong / git-bundle-hook.md
Created March 30, 2022 14:22 — forked from stefansundin/git-bundle-hook.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
@defong
defong / [images] sizing.sh
Last active October 25, 2021 13:37
[images] sizing
convert "1000 trainees.gif" -coalesce "coalesce/1000 trainees.gif"
convert "coalesce/1000 trainees.gif" -trim +repage -resize '640x320>' -gravity center -background transparent -extent 640x320 "cropped/1000 trainees.gif"
@defong
defong / [DfE] pe_allocations.rb
Last active August 26, 2021 11:08
[DfE] pe_allocations.rb
#######
# This is the latest (previous courses)
# flatten exploded courses over allocations + leftover allocations
# to use rails c
# copy and paste dump tip
#######
courses = Subject.find_by(subject_code: "C6").courses.with_recruitment_cycle(RecruitmentCycle.next.year).with_funding_types(["fee"])
items = Allocation.where(recruitment_cycle_id: RecruitmentCycle.current).map do |a |
{
accredited_body_code: a.accredited_body_code,
accredited_body_name: a.accredited_body.provider_name,
provider_code: a.provider_code,
provider_name: a.provider.provider_name,
confirmed_number_of_places: a.confirmed_number_of_places,
request_type: a.request_type,
number_of_places: a.number_of_places,
url: "https://qa.publish-teacher-training-courses.service.gov.uk/organisations/#{a.accredited_body_code}/2021/allocations",
@defong
defong / [DfE] lead_school.rb
Created February 24, 2021 11:52
[DfE] lead_school.rb
items = (RecruitmentCycle.current.providers.lead_school.map do |p|
p.users.non_admins.map do |u|
{
provider_name: p.provider_name,
email: u.email,
}
end
end).flatten
@defong
defong / subjects.rb
Last active November 4, 2020 10:52
[DfE] subjects list
SUBJECTS = [
{:name=>"Primary", :level=>:primary},
{:name=>"Primary with English", :level=>:primary},
{:name=>"Primary with geography and history", :level=>:primary},
{:name=>"Primary with mathematics", :level=>:primary},
{:name=>"Primary with modern languages", :level=>:primary},
{:name=>"Primary with physical education", :level=>:primary},
{:name=>"Primary with science", :level=>:primary},
{:name=>"Art and design", :level=>:secondary},
{:name=>"Science", :level=>:secondary},
@defong
defong / recent-activity.txt
Last active October 17, 2022 19:50
activity
🎉 Merged PR #3048 in DFE-Digital/publish-teacher-training
🗣 Commented on #1524 in DFE-Digital/find-teacher-training
🎉 Merged PR #1526 in DFE-Digital/find-teacher-training
🎉 Merged PR #1523 in DFE-Digital/find-teacher-training
🎉 Merged PR #1514 in DFE-Digital/find-teacher-training
@defong
defong / [DfE] 3507-financial-support-section-displaying-incorrect-information-for-provider.rb
Last active June 11, 2020 08:32
[DfE] 3507-financial-support-section-displaying-incorrect-information-for-provider.rb
issues = RecruitmentCycle.current.courses.with_funding_types(["apprenticeship"]).distinct
xxxx = issues.map do |c|
provider_code = c.provider.provider_code
course__findable = c.findable?
find_url = course__findable ? "https://www.find-postgraduate-teacher-training.service.gov.uk/course/#{provider_code}/#{c.course_code}" : ""
pub_url = "https://www.publish-teacher-training-courses.service.gov.uk/organisations/#{provider_code}/2020/courses/{c.course_code}"