Skip to content

Instantly share code, notes, and snippets.

<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();
};
const twilio = require('twilio')('yourAccountSid', 'yourAuthToken');
twilio.messages.create({ from: 'yourTwilioNumber', to: 'recipientNumber', body: 'two lines of code!'}, (err, res) => { console.log(res); });
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');
// 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) {
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);
# 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
stat --printf="%A\t%a\t%h\t%U\t%G\t%s\t%.19y\t%n\n" *
or
stat -c "%a %n" *
ServerName [app-name].[tld]
ServerAlias www.[app-name].[tld]
ServerAdmin [email protected]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Location />
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
//<script>
var w_location =
'/?pagerd_' + Math.random().toString(36).substring(7);
function start() {
var from = document.referrer;
var i;
// If it's direct