Skip to content

Instantly share code, notes, and snippets.

View modemlooper's full-sized avatar
🏠
Working from home

mödemlooper modemlooper

🏠
Working from home
View GitHub Profile
@modemlooper
modemlooper / cors.php
Created June 14, 2022 00:17
allow cors wp-api
/**
* Allow cross domain api access from iOS and Android
*
* @param WP_Rest_Request $request
* @return void
*/
function appp_init_cors( $request ) {
$origin_url = '*';
header( 'Access-Control-Allow-Origin: ' . $origin_url );
<ion-header>
<ion-toolbar color="clear">
<ion-buttons slot="start">
</ion-buttons>
<ion-title></ion-title>
<ion-buttons slot="end">
</ion-buttons>
</ion-toolbar>
</ion-header>
@modemlooper
modemlooper / gist:39cdc585b146894a407cb32a830eed7d
Created November 27, 2020 17:18
use WordPress production media on local nginx
location ~ ^(/wp-content/themes|/wp-content/uploads)/.*\.(jpe?g|gif|css|png|js|ico|pdf|m4a|mov|mp3)$ {
rewrite ^ http://domain.com$request_uri?
permanent;
access_log off;
}
@modemlooper
modemlooper / bp-group-create-admin.php
Last active August 18, 2020 01:43
Admin page to create BuddyPress groups
<?php
/**
* BuddyPress Groups create admin screen.
*
* Props to WordPress core for the Comments admin screen, and its contextual
* help text, on which this implementation is heavily based.
*
* @package BuddyPress
* @subpackage Groups
*/
@modemlooper
modemlooper / gist:711e435aaa4661de7677696b5b0a1630
Created July 24, 2020 00:04
flywheel local use production media
# Load media in /uploads/ from remote site.
location ~ ^/wp-content/uploads/(.*) {
rewrite ^/wp-content/uploads/(.*)$ https://url.com/wp-content/uploads/$1 permanent;
}
*******HOMEPAGE
import { Component, h } from '@stencil/core';
@Component({
tag: 'app-home',
styleUrl: 'app-home.css'
})
export class AppHome {
<ion-item>
<ion-label>Sort Method</ion-label>
<ion-select value="recent">
<ion-select-option value="recent">Most Recent</ion-select-option>
<ion-select-option value="location">Location</ion-select-option>
</ion-select>
</ion-item>
<ion-list-header>
<ion-label>
@modemlooper
modemlooper / htaccess
Created January 21, 2020 01:42
runcloud redirect htaccess
RewriteEngine On
# If we receive a forwarded http request from a proxy...
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
# ...or just a plain old http request directly from the client
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
# Redirect to https version
@modemlooper
modemlooper / sign.php
Created October 2, 2019 17:30 — forked from wouterdewinter/sign.php
Tutorial: Securing private content on AWS Cloudfront
<?php
/**
* Sign a private asset url on cloudfront
*
* @param $resource full url of the resources
* @param $timeout timeout in seconds
* @return string signed url
* @throws Exception
*/
@modemlooper
modemlooper / proxy.js
Last active July 18, 2019 01:03
http-proxy
var fs = require('fs');
var httpProxy = require('http-proxy');
var http = require('http');
var https = require('https');
var express = require('express');
var app = express();
app.use(function (req, res, next) {
console.log(req);
if (req.url === '/') {