Strings are primitive values in JavaScript and immutable. That is, string-related operations always produce new strings and never change existing strings.
Literals for strings:
const str1 = 'Don\'t say "goodbye"'; // string literal
module.exports = (config, Ferdium) => { | |
document.body.addEventListener("click", function (event) { | |
const qa = event.target.dataset.qa | |
const parentQA = event.target.parentElement?.dataset.qa | |
if (qa === "open-in-window" || parentQA === "open-in-window" || qa === "mini_player_open_in_new_window_button") { | |
toggleCustomStyles() | |
} | |
}) | |
function toggleCustomStyles() { |
#!/bin/bash | |
sudo rm -fr /opt/franz | |
sudo rm -fr /usr/share/applications/franz.desktop | |
# create installation dir | |
sudo mkdir -p /opt/franz | |
#install franz |
A small library for padding strings in JavaScript. Marmalade-free.
![NPM version][shield-npm] ![Node.js version support][shield-node] ![Build status][shield-build] ![Code coverage][shield-coverage]
require 'sinatra' | |
require 'sinatra' | |
require "cgi" | |
require 'json' | |
require 'tex2png' | |
| |
| |
def upload(path) | |
`curl -F file=@#{path} -F token=xoxp-xxxxxxxxx-xxxxxxxxx https://slack.com/api/files.upload` | |
end |
/** | |
* Node.js proxy to redirect domain to correct server | |
* Also check is server is alive or send a maintenance page | |
*/ | |
var http = require('http'), | |
httpProxy = require('http-proxy'), | |
proxy = httpProxy.createProxyServer({}), | |
request = require('request'), | |
domains = { | |
"domain1.com" : "localhost:8080", |
This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.
Most the credit for these changes go to Dave Holland.
var actionUtil = require('sails/lib/hooks/blueprints/actionUtil'); | |
module.exports = function getCount (req, res) { | |
var Model = actionUtil.parseModel(req) | |
, criteria = actionUtil.parseCriteria(req); | |
Model.count(criteria, function(error, response) { | |
if (error) { | |
return res.serverError('database_error', error); |