Skip to content

Instantly share code, notes, and snippets.

View stuk88's full-sized avatar

Stas Arshanski stuk88

  • Tel Aviv
View GitHub Profile
@stuk88
stuk88 / gist:bc72125725791ce833d50c50d2f20120
Last active August 9, 2022 13:12 — forked from davepullig/gist:efddb9a894e0c4a824b4b61183cfb01c
WP CLI search and replace URLs for WordPress multisite
wp search-replace --network --url=website.dev website.dev website.tld --precise --all-tables
@stuk88
stuk88 / fiddle.css
Last active May 24, 2022 08:17 — forked from anonymous/fiddle.css
Paper detection
.image:after {
display: block;
position: absolute;
width: 70%;
height: 70%;
border: 10px solid red;
}
video
{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<textarea rows=5 style="width:100%" id="source" onChange="updateQuery(this.value)"></textarea>
<textarea rows=5 style="width:100%" id="result"></textarea>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<textarea rows=5 style="width:100%" id="source" onChange="updateQuery(this.value)"></textarea>
<textarea rows=5 style="width:100%" id="result"></textarea>
/(?:SELECT\s+?([a-z][a-z0-9_,.()* ]*?)\s+){1}(?:FROM\s+([a-z_][a-z_$0-9@]+)\s+?){1}(?:JOIN\s+([a-z_][a-z_$0-9@]*?)\s+ON\s+([a-z][a-z0-9_,.]*?)\s+=\s+([a-z][a-z0-9_,.]*)\s+?)*(?:GROUP\sBY\s+?([a-z][a-z0-9_,.]+)\s*)?(?:ORDER\sBY\s+?([a-z][a-z0-9_,.]*)\s*?)?/i
@stuk88
stuk88 / api-policies-isOwner.js
Last active August 29, 2015 14:23
a generic way to check the queried model object
module.exports = function(req, res, next) {
// User is allowed, proceed to the next policy,
// or if this is the last policy, the controller
var policyValidator = ModelPolicy(req);
if (policyValidator.queriedModelCreteria({owner:req.session.user_id}) ) {
return next();
}