Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakerh400 committed Feb 19, 2018
1 parent 8ae9e39 commit c3b46f5
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 9 deletions.
1 change: 0 additions & 1 deletion blank/index.js

This file was deleted.

7 changes: 0 additions & 7 deletions blank/main.js

This file was deleted.

16 changes: 15 additions & 1 deletion github/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var minifier = require('../minifier');

var repos = require('./repos.json');
var noCopyList = require('./no-copy-list.json');
var skipList = require('./skip-list.json');
var supportedExtensions = require('./supported-extensions.json');

module.exports = {
Expand Down Expand Up @@ -90,8 +91,10 @@ function push(repoName, cb = O.nop){
// Copy files

fsRec.processFilesSync(src, e => {
var fp = e.fullPath;

if(e.processed) return;
if(e.fullPath.includes('node_modules')) return;
if(skipList.some(a => fp.endsWith(a) || fp.includes(`${a}\\`))) return;
if(noCopyList.some(a => e.name == a)) return;

var srcPath = e.relativePath.split(/[\/\\]/).slice(1).join`//`;
Expand All @@ -106,6 +109,7 @@ function push(repoName, cb = O.nop){
if(!supportedExtensions.some(a => ext == a)) return;

var content = fs.readFileSync(e.fullPath);
content = processFileContent(e.name, content);
fs.writeFileSync(destPath, content);
}
});
Expand All @@ -118,6 +122,16 @@ function push(repoName, cb = O.nop){
}
}

function processFileContent(file, buff){
var str = buff.toString();

switch(file){
case 'projects.txt': return O.sanl(str).filter(a => a !== 'blank' && a !== 'test').join`\n`; break;
}

return buff;
}

function resetDir(dir){
fsRec.processFilesSync(dir, e => {
var isGit = /(?:^|[\/\\])\.git(?:[^a-zA-Z0-9]|$)/.test(e.fullPath);
Expand Down
5 changes: 5 additions & 0 deletions github/skip-list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"blank",
"test",
"node_modules"
]
60 changes: 60 additions & 0 deletions lines/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'use strict';

var O = require('../framework');
var media = require('../media');
var logStatus = require('../log-status');

var w = 640;
var h = 480;
var fps = 60;
var hd = true;
var duration = 60 * 10;
var framesNum = fps * duration;

setTimeout(main);

function main(){
var arr = O.ca(w, () => 0)
var x, y;

media.renderVideo('-vid/1.mp4', w, h, fps, hd, (w, h, g, f) => {
logStatus(f, framesNum);

if(f === 1){
g.lineWidth = 3;
g.lineCap = 'round';
g.lineJoin = 'round';
}

y = 0;
for(x = 0; x < w; x++){
arr[x] += y;
y = Math.max(y, rand(h));
}

g.fillStyle = 'black';
g.fillRect(0, 0, w, h);

g.strokeStyle = 'yellow';
g.beginPath();
y = 1;
for(x = 0; x < w; x++){
g.lineTo(x, (1 - y) * h);
y = y * (2 - y) / 2;
}
g.stroke();

g.strokeStyle = 'red';
g.beginPath();
for(x = 0; x < w; x++){
g.lineTo(x, arr[x] / f);
}
g.stroke();

return f != framesNum;
});
}

function rand(a){
return Math.random() ** 20 * a;
}
27 changes: 27 additions & 0 deletions twitch-downloader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

var fs = require('fs');
var https = require('https');
var O = require('../framework');
var formatFileName = require('../format-file-name');

module.exports = {
download,
};

function download(user, file){
var url = `https://player.twitch.tv/?channel=${user}&amp;player=facebook&amp;autoplay=true`;
var filePath = formatFileName(file);
var fsStream = fs.createWriteStream(filePath);

downloadChunk(url, fsStream, () => {
console.log('Finished.');
});
}

function downloadChunk(url, fsStream, cb = O.nop){
https.get(url, res => {
res.on('data', d => fsStream.write(d));
res.on('end', () => cb(null));
});
}
12 changes: 12 additions & 0 deletions twitch-downloader/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

var twitch = require('.');

var user = 'ilmango';
var file = '-dw/1.ts';

setTimeout(main);

function main(){
twitch.download(user, file);
}

0 comments on commit c3b46f5

Please sign in to comment.