From 9893687e530cbd7ff6b19e76fde053c33cf95444 Mon Sep 17 00:00:00 2001 From: s-ol Date: Mon, 26 Nov 2018 16:23:21 +1100 Subject: embeddable tweets --- build/render_fileder.moon | 2 +- mmm/mmmfs/conversion.moon | 34 ++++++++++++++++++---- mmm/mmmfs/util.moon | 4 ++- .../mmm$tpl -> text$markdown.md | 18 ++++-------- .../tyktok_leds/URL -> twitter$tweet | 1 + .../tyktok_test/URL -> twitter$tweet | 1 + .../tyktok_tired/URL -> twitter$tweet | 1 + .../tyktok_tomcat/URL -> twitter$tweet | 1 + .../finished_case/URL -> twitter$tweet | 1 + .../stretching_gates/mmm$tpl -> text$markdown.md | 4 +-- .../mmm$tpl -> text$markdown.md | 4 +-- .../sketch_titler/URL -> twitter$tweet | 1 + 12 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 root/blog/clocks_triggers_gates/tyktok_leds/URL -> twitter$tweet create mode 100644 root/blog/clocks_triggers_gates/tyktok_test/URL -> twitter$tweet create mode 100644 root/blog/clocks_triggers_gates/tyktok_tired/URL -> twitter$tweet create mode 100644 root/blog/clocks_triggers_gates/tyktok_tomcat/URL -> twitter$tweet create mode 100644 root/blog/stretching_gates/finished_case/URL -> twitter$tweet create mode 100644 root/blog/video_synth_research/sketch_titler/URL -> twitter$tweet diff --git a/build/render_fileder.moon b/build/render_fileder.moon index b143f82..5a1a817 100644 --- a/build/render_fileder.moon +++ b/build/render_fileder.moon @@ -67,7 +67,7 @@ with io.open 'index.html', 'w' - + diff --git a/mmm/mmmfs/conversion.moon b/mmm/mmmfs/conversion.moon index dbaabea..161a96f 100644 --- a/mmm/mmmfs/conversion.moon +++ b/mmm/mmmfs/conversion.moon @@ -1,4 +1,4 @@ -import div, text, code, img, video, source, iframe from require 'mmm.dom' +import div, text, code, img, video, blockquote, a, source, iframe from require 'mmm.dom' import find_fileder, embed from (require 'mmm.mmmfs.util') require 'mmm.dom' import tohtml from require 'mmm.component' @@ -44,14 +44,22 @@ converts = { (html, fileder) -> div html\gsub '', (attrs) -> path, facet = '', '' + opts = {} while attrs and attrs != '' - key, val, attrs = attrs\match '^(%w+)="([^"]-)"%s*(.*)' + key, val, _attrs = attrs\match '^(%w+)="([^"]-)"%s*(.*)' + if not key + key, _attrs = attrs\match '^(%w+)%s*(.*)$' + val = true + + attrs = _attrs + switch key when 'path' then path = val when 'facet' then facet = val + when 'nolink' then opts.nolink = true else warn "unkown attribute '#{key}=\"#{val}\"' in " - embed path, facet, fileder + embed path, facet, fileder, opts else (html, fileder) -> with document\createElement 'div' @@ -63,8 +71,9 @@ converts = { for element in *embeds path = js_fix element\getAttribute 'path' facet = js_fix element\getAttribute 'facet' + nolink = js_fix element\getAttribute 'nolink' - element\replaceWith embed path, facet, fileder + element\replaceWith embed path, facet, fileder, { :nolink } }, { inp: 'text/lua -> (.+)', @@ -89,6 +98,21 @@ converts = { assert year, "failed to parse ISO 8601 date: '#{val}'" os.time :year, :month, :day }, + { + inp: 'URL -> twitter/tweet', + out: 'mmm/dom', + transform: (href) -> + id = assert (href\match 'twitter.com/[^/]-/status/(%d*)'), "couldn't parse twitter/tweet URL: '#{href}'" + if MODE == 'CLIENT' + with parent = div! + window.twttr.widgets\createTweet id, parent + else + div blockquote { + class: 'twitter-tweet' + 'data-lang': 'en' + a '(linked tweet)', :href + } + }, { inp: 'URL -> youtube', out: 'mmm/dom', @@ -98,7 +122,7 @@ converts = { id or= link\match 'youtube.com/[ev]/([^/]+)' id or= link\match 'youtube.com/embed/([^/]+)' - assert id, "couldn't parse youtube URL: #{link}" + assert id, "couldn't parse youtube URL: '#{link}'" iframe { width: 560 diff --git a/mmm/mmmfs/util.moon b/mmm/mmmfs/util.moon index e7a4c4e..01604a9 100644 --- a/mmm/mmmfs/util.moon +++ b/mmm/mmmfs/util.moon @@ -24,10 +24,12 @@ BROWSER\navigate fileder.path } - embed = (fileder, name='', origin) -> + embed = (fileder, name='', origin, opts={}) -> fileder = find_fileder fileder, origin node = fileder\gett name, 'mmm/dom' + + return node if opts.nolink link_to fileder, node { diff --git a/root/blog/clocks_triggers_gates/mmm$tpl -> text$markdown.md b/root/blog/clocks_triggers_gates/mmm$tpl -> text$markdown.md index 907b41d..240cf80 100644 --- a/root/blog/clocks_triggers_gates/mmm$tpl -> text$markdown.md +++ b/root/blog/clocks_triggers_gates/mmm$tpl -> text$markdown.md @@ -40,7 +40,7 @@ sequencers. Originally I thought about putting a light dependant resistor (LDR) somewhere under the counterweight, and measure the shadow as a signal. In the time until I got the Metronome, I discussed this with Sam Battle, who runs the awesome -youtube channel [LOOK MUM NO COMPUTER][no-computer] and he proposed to use a piezo crystal +youtube channel [LOOK MUM NO COMPUTER][no-computer], and he proposed to use a piezo crystal (sometimes referred to as *Contact Mic*) instead. As it turns out, the metronome has plenty of space to glue the piezo right next to the metal plate @@ -49,9 +49,7 @@ The 1/4" (6.3mm) audio jack also fit very well behind the panel, where there is empty compartment, I guess to amplifiy the ticking sound. I just drilled a hole in the back, screwed the jack in and soldered two wires; done! - + In this first test you can see the Piezo work as a microphone amplifying the ticking noise on my speakers. @@ -82,9 +80,7 @@ I just set it up to light up 4 LEDs in sequence, so that I could see whether the After an hour or so of figuring out stupid wiring mistakes and learning about open-drain outputs it was working: - + (this tweet is mislabeled, Juan's sequencer is in the next video). [Juan][juan] had an Akai Tomcat drum machine on hand, and we were stoked to try it out. @@ -92,18 +88,14 @@ As usual at first, it didn't work at all. Pretty soon we figured out that the signal was just too quiet coming off our 9V supply, so we put an amplifier in between (alongside a whole mess of cables) and behold: - + This worked pretty well, surprisingly! With the potentiometer set *just right*, it rarely triggered twice, and ran for some time before the spring weakened and the sound became a tiny bit more quiet and failed to trigger every beat. This is also a really nice effect actually and transforms rather simple beats into nice wacky ones: - + The schematic at this point is very simple: diff --git a/root/blog/clocks_triggers_gates/tyktok_leds/URL -> twitter$tweet b/root/blog/clocks_triggers_gates/tyktok_leds/URL -> twitter$tweet new file mode 100644 index 0000000..48ecab3 --- /dev/null +++ b/root/blog/clocks_triggers_gates/tyktok_leds/URL -> twitter$tweet @@ -0,0 +1 @@ +https://twitter.com/S0lll0s/status/879046250880008193 diff --git a/root/blog/clocks_triggers_gates/tyktok_test/URL -> twitter$tweet b/root/blog/clocks_triggers_gates/tyktok_test/URL -> twitter$tweet new file mode 100644 index 0000000..407ae05 --- /dev/null +++ b/root/blog/clocks_triggers_gates/tyktok_test/URL -> twitter$tweet @@ -0,0 +1 @@ +https://twitter.com/S0lll0s/status/878328052744241152 diff --git a/root/blog/clocks_triggers_gates/tyktok_tired/URL -> twitter$tweet b/root/blog/clocks_triggers_gates/tyktok_tired/URL -> twitter$tweet new file mode 100644 index 0000000..564a9d7 --- /dev/null +++ b/root/blog/clocks_triggers_gates/tyktok_tired/URL -> twitter$tweet @@ -0,0 +1 @@ +https://twitter.com/S0lll0s/status/879072879924711426 diff --git a/root/blog/clocks_triggers_gates/tyktok_tomcat/URL -> twitter$tweet b/root/blog/clocks_triggers_gates/tyktok_tomcat/URL -> twitter$tweet new file mode 100644 index 0000000..04aacc8 --- /dev/null +++ b/root/blog/clocks_triggers_gates/tyktok_tomcat/URL -> twitter$tweet @@ -0,0 +1 @@ +https://twitter.com/S0lll0s/status/879061152520699904 diff --git a/root/blog/stretching_gates/finished_case/URL -> twitter$tweet b/root/blog/stretching_gates/finished_case/URL -> twitter$tweet new file mode 100644 index 0000000..bc7b385 --- /dev/null +++ b/root/blog/stretching_gates/finished_case/URL -> twitter$tweet @@ -0,0 +1 @@ +https://twitter.com/S0lll0s/status/881940776749543427 diff --git a/root/blog/stretching_gates/mmm$tpl -> text$markdown.md b/root/blog/stretching_gates/mmm$tpl -> text$markdown.md index 8312dc7..3c30727 100644 --- a/root/blog/stretching_gates/mmm$tpl -> text$markdown.md +++ b/root/blog/stretching_gates/mmm$tpl -> text$markdown.md @@ -78,9 +78,7 @@ made quick work of all that. Juan finished the top of the case with mounting hol potentiometers, the input jack, the switch, and two hot-glue-covered holes for the LEDs to shine through. - + [juan]: https://twitter.com/juanorloz [555-src]: https://electrosome.com/monostable-multivibrator-555-timer/ diff --git a/root/blog/video_synth_research/mmm$tpl -> text$markdown.md b/root/blog/video_synth_research/mmm$tpl -> text$markdown.md index 4073f7e..1698dee 100644 --- a/root/blog/video_synth_research/mmm$tpl -> text$markdown.md +++ b/root/blog/video_synth_research/mmm$tpl -> text$markdown.md @@ -56,9 +56,7 @@ the amount of steps the brightness scale is sliced into. ## OBS -2.3 The other videoish thing we have going on sofar is this: - + this *SONY Family Studio* 'Video Sketch Titler' is basically a little box that you connect inbetween your video camera with some awesome family vacation clips on tape and your VHS recorder, which is diff --git a/root/blog/video_synth_research/sketch_titler/URL -> twitter$tweet b/root/blog/video_synth_research/sketch_titler/URL -> twitter$tweet new file mode 100644 index 0000000..e99f085 --- /dev/null +++ b/root/blog/video_synth_research/sketch_titler/URL -> twitter$tweet @@ -0,0 +1 @@ +https://twitter.com/S0lll0s/status/876077574639767552 -- cgit v1.2.3