This file contains hidden or 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
stat --printf="%A\t%a\t%h\t%U\t%G\t%s\t%.19y\t%n\n" * | |
or | |
stat -c "%a %n" * |
This file contains hidden or 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
# enable site | |
$ sudo a2ensite [site-file] | |
# disable site | |
$ sudo a2dissite [site-file] | |
# enable an apache2 module -> create correct symlinks in mods-enabled | |
$ sudo a2enmod [module] | |
# disable an apache2 module |
This file contains hidden or 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 canvasDragCrop = { | |
_defaults: { | |
CANVAS_MIN_WIDTH: 100, | |
CANVAS_MIN_HEIGHT: 100 | |
}, | |
init: function (canvas, options) { | |
if (options === void 0) { options = {}; } | |
var _options = $.extend(this._defaults, options); |
This file contains hidden or 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
// here's an example of both higher order functions and currying. | |
// jquery's 'on' and 'each' are both higher order functions, as we pass functions as arguments. | |
// before we use the saveSubscriber function within the anonymous function passed into each, we curry it with the total # rows | |
// to establish an upper limit (so we know when we've processed the last row) - the returned function is saveRow | |
$(document).on('click', '#save-permissions', function() { | |
var $modifiedRows = $('#subscribers-bulk').find('tr.modified'); | |
// here we curry saveSubscriber, passing in the the number of modified rows | |
var saveRow = saveSubscriber($modifiedRows.length); | |
$modifiedRows.each(function(index) { |
This file contains hidden or 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
const fizzbuzz = Array.apply(null, {length: 100}).map(Number.call, Number).map(n => { let res = ''; res += n % 3 === 0 ? 'fizz' : ''; res += n % 5 === 0 ? 'buzz' : ''; return res.length ? res : n; }).join('\n\r'); | |
This file contains hidden or 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
const twilio = require('twilio')('yourAccountSid', 'yourAuthToken'); | |
twilio.messages.create({ from: 'yourTwilioNumber', to: 'recipientNumber', body: 'two lines of code!'}, (err, res) => { console.log(res); }); |
This file contains hidden or 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
<script> | |
var links = document.getElementsByTagName('a'); | |
for (var i = 0; i < links.length; i++) { | |
var link = links[0]; | |
if (link.href.toString().search(/forbes/ig) > -1) { | |
link.onclick = function (e) { | |
var proceed = confirm('This website requires add blockers to be turned off. Proceed?'); | |
if (!proceed) | |
e.preventDefault(); | |
}; |
NewerOlder