Skip to content

Instantly share code, notes, and snippets.

View MartinMouritzen's full-sized avatar

Martin Mouritzen MartinMouritzen

View GitHub Profile
@MartinMouritzen
MartinMouritzen / remove_silence.ts
Created October 19, 2020 14:36 — forked from smashah/remove_silence.ts
A simple way to remove silences below a certain threshold in an audio file [NODEJS/TS]
//add this to your package.json
// "audio-buffer-utils": "^5.1.2",
// "audio-decode": "^1.4.0",
// "audiobuffer-to-wav": "^1.0.0",
// "node-lame": "^1.2.0",
// "ogg.js": "^0.1.0",
// "opus.js": "^0.1.1",
const fs = require('fs');
<?
print "<h1>Hello world</h1>\n";
print "A simple counter:<br>\n";
for($i=0;$i<10;$i++) {
print $i."<br>\n";
}
?>
/**
*
*/
class ExecPHP {
/**
*
*/
constructor() {
this.phpPath = 'C:\\Users\\Martin\\Desktop\\Dropbox\\Mediumprojects\\phpinnode\\php\\php.exe';
this.phpFolder = '';
var express = require('express');
var app = express();
var execPHP = require('./execphp.js')();
execPHP.phpFolder = 'C:\\Users\\Martin\\Desktop\\Dropbox\\Mediumprojects\\phpinnode\\phpfiles\\';
app.use('*.php',function(request,response,next) {
execPHP.parseFile(request.originalUrl,function(phpResult) {
response.write(phpResult);
// This will stop the application and give you a nice "ReferenceError: test is not defined"
test = 'hello';
console.log(test);
// This is the way to do it, by defining the variable using "var"
var test = 'hello';
console.log(test);
function Person() {
this.id = 'id_1';
}
Person.prototype.setName = function(name) {
this.name = name.charAt(0).toUpperCase() + name.slice(1);
};
Person.prototype.sayHello = function() {
console.log('Hello, my name is ' + this.name + ', I have ID: ' + this.id);
};
class Person {
constructor() {
this.id = 'id_1';
}
set name(name) {
this._name = name.charAt(0).toUpperCase() + name.slice(1);
}
get name() {
return this._name;
}
atom.workspace.onDidChangeActivePaneItem(function(editor) {
var tabs = document.getElementsByClassName('tab');
for(var i=0;i<tabs.length;i++) {
var fileName = tabs[i].childNodes[0].getAttribute('data-name');
var ext = fileName.substr(fileName.lastIndexOf('.') + 1);
var className = 'filetype_' + ext;
if (!tabs[i].classList.contains(className)) {
tabs[i].classList.add(className);
}