Put SearchTrait.php
in app
directory. Then use SearchTrait
in your model, like so
use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
'use strict'; | |
const crypto = require('crypto'); | |
const ENC_KEY = "bf3c199c2470cb477d907b1e0917c17b"; // set random encryption key | |
const IV = "5183666c72eec9e4"; // set random initialisation vector | |
// ENC_KEY and IV can be generated as crypto.randomBytes(32).toString('hex'); | |
const phrase = "who let the dogs out"; | |
var encrypt = ((val) => { |
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv); |
//This should have each valid amount that can be selected in the slider | |
var sliderAmountMap = [10000, 20000,30000, 40000, 45000,50000,65000]; | |
$(function() { | |
$( "#slider" ).slider({ | |
value: 4, //array index of onload selected default value on slider, for example, 45000 in same array will be selected as default on load | |
min: 0, //the values will be from 0 to array length-1 | |
max: sliderAmountMap.length-1, //the max length, slider will snap until this point in equal width increments |
# /etc/logrotate.d/cloudflared | |
/var/log/cloudflared/cloudflared.log { | |
rotate 7 | |
daily | |
compress | |
missingok | |
notifempty | |
} |
Ramp up your Kubernetes development, CI-tooling or testing workflow by running multiple Kubernetes clusters on Ubuntu Linux with KVM and minikube.
In this tutorial we will combine the popular minikube
tool with Linux's Kernel-based Virtual Machine (KVM) support. It is a great way to re-purpose an old machine that you found on eBay or have gathering gust under your desk. An Intel NUC would also make a great host for this tutorial if you want to buy some new hardware. Another popular angle is to use a bare metal host in the cloud and I've provided some details on that below.
We'll set up all the tooling so that you can build one or many single-node Kubernetes clusters and then deploy applications to them such as OpenFaaS using familiar tooling like helm. I'll then show you how to access the Kubernetes clusters from a remote machine such as your laptop.
# remove specific file from git cache | |
git rm --cached filename | |
# remove all files from git cache | |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
pm2 start app.js --interpreter ./node_modules/.bin/babel-node |
I this is part of the first node web scraper I created with axios and cheerio. I took out all of the logic, since I only wanted to showcase how a basic setup for a nodejs web scraper would look.
const cheerio = require('cheerio'),
axios = require('axios'),
url = `<url goes here>`;