Fastpack - pack JavaScript fast & easy
This gist is a submission for a lightning talk on the ReactiveConf 2018.
- JavaScript bundling can be a lot faster
- There are proper tools to guarantee consistency
- Writing OCaml code is fun!
| /* Micro ClearFix Mixin */ | |
| .clearfix{ | |
| zoom:1; | |
| &:before, &:after{ content:""; display:table; } | |
| &:after{ clear: both; } | |
| } |
| var crypto = require('crypto'); | |
| /* | |
| * node.js ssha hash generation and check functions intended for use with LDAP servers. | |
| */ | |
| function ssha(cleartext, salt) { | |
| var sum = crypto.createHash('sha1'); | |
| ( typeof(salt) == 'undefined') ? salt = new Buffer(crypto.randomBytes(20)).toString('base64') : salt = salt; | |
| sum.update(cleartext); |
| // Create our server | |
| var server; | |
| server = http.createServer(function(req,res){ | |
| // Set CORS headers | |
| res.setHeader('Access-Control-Allow-Origin', '*'); | |
| res.setHeader('Access-Control-Request-Method', '*'); | |
| res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET'); | |
| res.setHeader('Access-Control-Allow-Headers', '*'); | |
| if ( req.method === 'OPTIONS' ) { | |
| res.writeHead(200); |
| // config/passport.js | |
| // load all the things we need | |
| var LocalStrategy = require('passport-local').Strategy; | |
| var mysql = require('mysql'); | |
| var connection = mysql.createConnection({ | |
| host : 'localhost', | |
| user : 'root', |
| to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice | |
| stun: | |
| stun.l.google.com:19302, | |
| stun1.l.google.com:19302, | |
| stun2.l.google.com:19302, | |
| stun3.l.google.com:19302, | |
| stun4.l.google.com:19302, | |
| stun.ekiga.net, | |
| stun.ideasip.com, |
| // ZWJ-последовательность: семья (мужчина, женщина, мальчик) | |
| // U+1F468 + U+200D + U+1F469 + U+200D + U+1F466 | |
| [...'👨👩👦'] // ["👨", "", "👩", "", "👦"] | |
| ‘👨👩👦’.length // 8 | |
| // нейтральная семья | |
| // U+1F46A | |
| [...’👪’] // [’👪’] | |
| ’👪’.length // 2 |
This gist is a submission for a lightning talk on the ReactiveConf 2018.
Deploys for static sites or web apps made easy with GitHub Actions
A generic but elegant CI flow for deploying a site to Github Pages - this is triggered on a push to master and runs on Github Actions - docs.
This workflow is targeted at a static site like Hexo or a single-page applciation like React project. It doesn't matter what the language is as long as your build steps results in a public directory which can be served on Github Pages.