- Part 1: Начало статического блога. Immutant, Ring, Compojure, HTML rendering через Rum
- Part 2: Forms, middlewares, redirects, 404 and error handling
- Part 3: id generator, loops, cookies, sessions, authorization, working w/ files, macros
- Part 4: Cookies, рефакторинг, неймспейсы, RSS фид
- Part 5: Infinite Scroll на JS, sitemap.xml, robots.txt
- Part 6: Настраиваем CLJS окружение
- Part 7: Переделываем форму редактирования на Rum, клиент+сервер-сайд рендеринг, EDN-сериализация данных
- Part 8: CLJS, drag-n-drop upload, browser API, Rum mixins, local state
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
/** | |
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts. | |
* | |
* Note that this uses an older fork of stable-diffusion | |
* with the 'txt2img.py' script, and that script was modified to | |
* support the --outfile command. | |
*/ | |
var { spawn, exec } = require("child_process"); | |
var path = require("path"); |
There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.
- ffmpeg
- macOS:
brew install ffmpeg
- Ubuntu/Debian:
apt install ffmpeg
- macOS:
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
# Use this script to test that your Telegram bot works. | |
# | |
# Install the dependency | |
# | |
# $ gem install telegram_bot | |
# | |
# Run the bot | |
# | |
# $ ruby bot.rb | |
# |
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
const all = (...preds) => (obj) => preds.map(f => f(obj)).reduce((a, b) => a && b, true) | |
const any = (...preds) => (obj) => preds.map(f => f(obj)).reduce((a, b) => a || b, false) | |
const oneOf = (...preds) => (obj) => preds.map(f => f(obj)).reduce((a, b) => a ? !b : b, false) | |
const has = (prop) => (obj) => obj[prop] !== undefined | |
const not = (pred) => (obj) => !pred(obj) | |
const equals = (prop, val) => (obj) => obj[prop] === val | |
const implies = (f, g) => (obj) => !f(obj) || g(obj); | |
const validate = all(implies(has('selectedIndex'), equals('isOpen', true))) |
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
// @flow | |
import React from 'react'; | |
import styled from 'styled-components'; | |
type GlobalCssValues = 'initial' | 'inherit' | 'unset'; | |
type WrapValue = 'nowrap' | 'wrap' | 'wrap-reverse' | GlobalCssValues; | |
type JustifyValue = | |
| 'center' |
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
#! /usr/bin/env node | |
// I am ./bin/buildSitemap.js | |
const path = require('path') | |
const glob = require('glob') | |
const fs = require('fs') | |
const SITE_ROOT = process.env.SITE_ROOT || 'https://www.actionherojs.com' | |
const SOURCE = process.env.SOURCE || path.join(__dirname, '..', 'pages', '/**/*.js') | |
const DESTINATION = process.env.DESTINATION || path.join(__dirname, '..', 'static', 'sitemap.xml') |
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
import dep2 from './dep-2.js'; | |
export default function() { | |
return dep2(); | |
} |
See also 📰 Dead simple tweetable JavaScript PubSub pattern module using Set (ES2015) which this package uses.
Chrome* | Edge | FF | IE | Opera | Safari | iOS |
---|---|---|---|---|---|---|
38 | 12 | 13 | -* | 25 | 7.1 | 8 |
Notes:
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
b=0;$=x=>(p,i="_"+b++,u=($[i]=q=>eval(i).innerHTML=x(p,$[q],u),z=>($[++b]=z,`$.${i}(${b})`)))=>`<c id=${i}>${x(p,[]._,u)}</c>` |
NewerOlder