@stcgoal Extract decorator from string
#!/bin/bash
npm i gixdeco --save
//@stcaction How to extract email in string using regular expression | |
var re = /(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/g; | |
var text = "my email is my@mydomain.com"; | |
function extractEmails(text) { | |
return text.match(re); |
#@q How to publish a vscode package extension using command line? | |
#Install the tool | |
sudo npm install -g vsce | |
# Publishing | |
vsce publish | |
<body> | |
<p> Abbreviation: <abbr title="An Advancing company">Google</abbr></p> | |
</body> | |
{ | |
"rulesDirectory": [ | |
"codelyzer" | |
], | |
"rules": { | |
"arrow-return-shorthand": true, | |
"callable-types": true, | |
"class-name": true, | |
"comment-format": [ | |
true, |
#@q What is Rails On Node: Opinionated Node.js Framework? | |
# Features | |
# Create a new multithread Node.js server with Pug templating with 8 threads (Ruby on Rails has 5 for their server's scalibity) | |
# Setup your own database (any SQL database or MongoDB) | |
# Generate new api controllers | |
# Generate new api versions | |
# Creates automatic API documentation for endpoints on creation with no extra configuration | |
# Creates automatic unit tests for endpoints on creation with no extra configuration | |
# Generate new pages with assets with a custom route with code splitting | |
# Use serverside React or Vanilla JS (JQuery, etc.) |
const text = 'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.'; | |
getUrls(text); | |
//=> Set {'http://sindresorhus.com', 'http://yeoman.io'} |
# Load Json into a Python object | |
import urllib2 | |
import json | |
req = urllib2.Request("http://localhost:81/sensors/temperature.json") | |
opener = urllib2.build_opener() | |
f = opener.open(req) | |
json = json.loads(f.read()) | |
print json | |
print json['unit'] |
$("#wrap_chat_messages").click(function () { | |
alert("Handler for .click() called."); | |
}); |
const frameguard = require('frameguard') | |
// Don't allow me to be in ANY frames: | |
app.use(frameguard({ action: 'deny' })) | |
// Only let me be framed by people of the same origin: | |
app.use(frameguard({ action: 'sameorigin' })) | |
app.use(frameguard()) // defaults to sameorigin | |
// Allow from a specific host: |