Skip to content

Instantly share code, notes, and snippets.

View BKeanu1989's full-sized avatar

Kevin Fechner BKeanu1989

View GitHub Profile
{
"title" : "code-university",
"name" : "Code University",
"logo" : "code_university.png",
"link" : "https://code.berlin",
"infos" : "<p>test</p>",
"trusteeship" : "privat",
"study_programs" : {
"Informatik" : [
{
@BKeanu1989
BKeanu1989 / vue js pwa
Created June 28, 2017 07:44
vue js pwa
npm install -g vue-cli
vue init pwa my-project
cd my-project
npm install
npm run dev
@BKeanu1989
BKeanu1989 / Empty 1x1 pixel-img
Last active July 17, 2017 17:45
empty 1x1 pixel
SOURCE: http://proger.i-forge.net/%D0%9A%D0%BE%D0%BC%D0%BF%D1%8C%D1%8E%D1%82%D0%B5%D1%80/[20121112]%20The%20smallest%20transparent%20pixel.html
data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=
@BKeanu1989
BKeanu1989 / htaccess redirect
Last active August 30, 2017 15:26
apache redirects
SSL
www -> non-www
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
----- use this
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
@BKeanu1989
BKeanu1989 / add-wc-products-programmatically.php
Last active March 14, 2024 15:30
adding woocommerce productgs programmatically/ via code
function insert_product ($product_data)
{
$post = array( // Set up the basic post data to insert for our product
'post_author' => 1,
'post_content' => $product_data['description'],
'post_status' => 'publish',
'post_title' => $product_data['name'],
'post_parent' => '',
pm2 start ecosystem.config.js --env production_mongodb
scp /path/to/file username@a:/path/to/destination
tar -czvf foo-bar.tar.gz `find foo-bar*`
find ./order-export-* -maxdepth 0 -type f -delete
db.createUser(
{
user: "XXX",
pwd: "XXX",
roles: [ { role: "root", db: "admin" } ]
}
)
mongoimport -u 'ACTUALUSERNAME' -p 'PASSWORD' --authenticationDatabase admin -d DATABASE -c COLLECTION --type csv --file FILEPATH.csv --headerline
# sudo nano /etc/nginx/sites-enabled/default
# HTTP — redirect all traffic to HTTPS
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
}
# HTTPS — proxy all requests to the Node app
@BKeanu1989
BKeanu1989 / waitForElementToAppear.js
Created February 18, 2017 18:48
Wait for element to appear, setTimeout
function waitForElementToAppear(selector, time) {
if(document.querySelector(selector)!=null) {
alert("The element is displayed, you can put your code instead of this alert.");
return;
}
else {
setTimeout(function() {
waitForElementToAppear(selector, time);
}, time);
}
@BKeanu1989
BKeanu1989 / listCookies()
Last active February 9, 2017 14:01
listCookies.js
function listCookies() {
var theCookies = document.cookie.split(';');
var aString = '';
for (var i = 1 ; i <= theCookies.length; i++) {
aString += i + ' ' + theCookies[i-1] + "\n";
}
return aString;
}
listCookies();