Skip to content

Instantly share code, notes, and snippets.

View leotm's full-sized avatar

LeoTM leotm

View GitHub Profile
@leotm
leotm / delete.js
Last active August 29, 2015 14:25
Node.js - Delete file(s)
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) {
@leotm
leotm / rename.js
Last active August 29, 2015 14:25
Node.js - Rename file(s)
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');
@leotm
leotm / append.js
Last active August 29, 2015 14:25
Node.js - Append regexp to file(s)
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');
@leotm
leotm / .jscsrc
Last active August 29, 2015 14:26
JSCS - JavaScript Code Style - Rules
{
"jscsVersion": "2.0.0",
"preset": "google",
"fileExtensions": [".js", "jscs"],
"validateQuoteMarks": true,
"requireParenthesesAroundIIFE": true,
"maximumLineLength": 120,
"validateLineBreaks": "LF",
@leotm
leotm / getLinks.js
Last active August 29, 2015 14:26
Get all links from website
@leotm
leotm / getLinks.js
Last active August 29, 2015 14:26
Download all links from website
@leotm
leotm / win10lnks.txt
Created August 6, 2015 13:15
Windows 10 shortcuts
Quick Launch: C:\Users\<User>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
TaskBar: C:\Users\<User>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
Start Menu: C:\Users\<User>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Links: C:\Users\<User>\.cr3\Links
@leotm
leotm / git-cmd.bat
Last active August 29, 2015 14:26
GitHub for Windows - amended git-cmd.bat path to open in "Documents\GitHub" folder
@rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the absolute path to the current directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%PATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%\Documents\GitHub
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@leotm
leotm / page.is_addLink.js
Last active August 29, 2015 14:27
Page.is - Add Link - add more social profiles
@leotm
leotm / page.hbs
Created October 9, 2015 12:12 — forked from geekhunger/page.hbs
Ghost - List of posts inside post.hbs and page.hbs
...
{{> posts_list}}
...