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
# AppData\Roaming\Sublime Text 3\Packages\User\default_syntax.py | |
import sublime, sublime_plugin | |
class DefaultSyntaxCommand(sublime_plugin.EventListener): | |
def on_new(self, view): | |
# Replace <Language> with desired default language | |
# Check in AppData\Local\Sublime Text 3\Cache | |
view.set_syntax_file('Packages/<Language>/<Language>.tmLanguage') |
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
var glob = require('glob'); | |
var fs = require('fs'); | |
var replace = require('replace'); | |
// Find file(s) | |
glob('fileName.txt', function(err, files) { | |
if (err) { throw err; } | |
files.forEach(function(item, index, array) { | |
console.log(item + ' found'); |
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
var glob = require('glob'); | |
var fs = require('fs'); | |
// Find file(s) | |
glob('**/fileName.ext', function(err, files) { | |
if (err) { throw err; } | |
files.forEach(function(item, index, array) { | |
console.log(item + ' found'); | |
// Delete file(s) | |
fs.unlink(item, function(err) { |
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
var glob = require('glob'); | |
var fs = require('fs'); | |
// Find file(s) | |
glob('fileName.ext', function(err, files) { | |
if (err) { throw err; } | |
// Check for file(s) | |
if (Boolean(files.length)) { | |
files.forEach(function(item, index, array) { | |
var newItem = item.replace('regexp', 'replacement'); |
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
var glob = require('glob'); | |
var fs = require('fs'); | |
// Find file(s) | |
glob('fileName.ext', function(err, files) { | |
if (err) { throw err; } | |
files.forEach(function(item, index, array) { | |
console.log(item + ' found.'); | |
// Read file(s) | |
var file = fs.readFileSync(item, 'utf8'); |
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
Show hidden characters
{ | |
"jscsVersion": "2.0.0", | |
"preset": "google", | |
"fileExtensions": [".js", "jscs"], | |
"validateQuoteMarks": true, | |
"requireParenthesesAroundIIFE": true, | |
"maximumLineLength": 120, | |
"validateLineBreaks": "LF", |
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
var links = []; | |
// Replace .ext with desired filetype | |
Array.prototype.map.call(document.querySelectorAll("a[href$=\".ext\"]"), | |
function(e, i) { | |
if ((links || []).indexOf(e.href) == -1) { links.push(e.href); } | |
}); | |
console.log(links.join(" ")); | |
// Optionally copy result to clipboard |
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
var links = []; | |
// Replace .ext with desired filetype | |
Array.prototype.map.call(document.querySelectorAll("a[href$=\".ext\"]"), | |
function(e, i) { | |
if ((links || []).indexOf(e.href) == -1) { links.push(e.href); } | |
}); | |
console.log(links.join(" ")); | |
// Copy result to clipboard |
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
var fs = require("fs"); | |
var glob = require("glob"); | |
glob('*.ovpn', function (err, files) { | |
if (err) { throw err; } | |
files.forEach(function(item,index,array){ | |
// Each .ovpn file will use login.conf containing un and pw | |
fs.appendFile(item, ' auth-user-pass login.conf', function (err) {}); | |
}); | |
}); |
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
// This will sort all IPVanish config/.ovpn files (e.g. ipvanish-BE-Brussels-bru-b01.ovpn) | |
// into respective folders (e.g. ipvanish-BE) | |
var glob = require('glob'); | |
var fs = require('fs'); | |
glob('*.ovpn', function(err, files) { | |
if (err) { throw err; } | |
files.forEach(function(item, index, array) { | |
// Create the folders |
OlderNewer