Skip to content

Instantly share code, notes, and snippets.

Example of curl request using a presigned url from server to post to S3

curl -i -X PUT -H "Content-Type:application/pdf" --data-binary "@ar-2016.pdf" https://s3-8it.s3.amazonaws.com/ar-2016.pdf?AWSAccessKeyId={awsaccesskeyid}&Content-Type=application%2Fpdf&Expires=1533263152&Signature=sH8FfRI35Do6QxrQxhP1rwhqP9c%3D

In the example above, -i prints out all the headers so that you can see what's going on, and -X POST makes it explicit that this is a post. Both of these can be safely omitted without changing the behaviour on the wire. The path to the file needs to be preceded by an @ symbol, so curl knows to read from a file. - Marian stackoverflow 2018 https://stackoverflow.com/questions/6408904/send-post-request-with-data-specified-in-file-via-curl

@rexfng
rexfng / install-php-7.sh
Created November 2, 2017 14:30 — forked from mavieth/install-php-7.sh
Upgrade from PHP 5.X.X to PHP 7 on an AWS EC2 Linux Server
#!/bin/bash
echo "==============================="
echo "Installing PHP 7"
echo "==============================="
sudo yum install php70
echo "==============================="
echo "Installing PHP 7 additional commonly used php packages"
echo "==============================="
var titles = document.getElementsByClassName('title');
var searchResult = document.getElementById('searchResult');
searchBar(titles);
function searchBar(dom){
var search = document.getElementById('search');
search.addEventListener('keyup', function(event){
function clearList(){
while (searchResult.firstChild) {
@rexfng
rexfng / ss.js
Last active April 25, 2017 20:44
<script>
document.onload = function(){
var nav = document.getElementById('mainNavWrapper');
nav.childNodes[1].children[0].innerHTML = "<a href='/'>Home</a>";
nav.childNodes[1].children[1].innerHTML = "<a href='/news'>News</a>";
nav.childNodes[1].children[2].innerHTML ="<div class='folder'><div class='folder-toggle' data-href='/about/'>About Us</div><div class='subnav'><div class='collection'><a href='/partners/'>Talent</a></div><div class='collection'><a href='/what-we-do/'>Technology</a></div><div class='collection'><a href='/projects/'>Business</a></div><div class='collection'><a href='/page/'>Culture</a></div></div></div>";
nav.childNodes[1].children[3].innerHTML = "<a href='/read-me'>Events</a>";
nav.childNodes[1].children[4].innerHTML = "<a href='/nbgmembers'>Members</a>";
  1. Create a new template with "template-NAME" in the theme file ;
  2. Add header /* Template Name: Home Template */ within the php tag.
  3. Create a new page in wordpress admin.
  4. Select the template you have created to use it.

**Route template to root **

  • Appearance > Customize > Static Homepage > Choose your template as home
var gulp = require('gulp');
var babel = require('gulp-babel');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sassOptions = {
errLogToConsole: true,
outputStyle: 'expanded'
};
gulp.task('scss', function () {
@rexfng
rexfng / gist:99c075569699737cc6b693304541cbcd
Last active December 10, 2016 03:22
simplelumen_ajax_form
<!DOCTYPE html>
<html>
<head>
<title>Fomr</title>
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans|Open+Sans|Roboto" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<style type="text/css">
body{
font-family: 'Roboto', sans-serif;
}
@rexfng
rexfng / gist:a7baf53fdf2fe9321f6fadd66ffc454f
Created December 10, 2016 02:42
simplelumen_ajax_form
jQuery.ajax({
type: 'POST',
url: "https://simplelumen-api.herokuapp.com/orders.json",
data: JSON.stringify({
id : "1",
name : "Lumi Panel",
color : "RGB",
measurement : "2m x 4m",
d_sided : false,
lumen : "150",
@rexfng
rexfng / paths.php
Created September 1, 2016 22:58 — forked from lavoiesl/paths.php
PHP Document Root, Path and URL detection.
<?php
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
$base_url = preg_replace("!^${doc_root}!", '', $base_dir); # ex: '' or '/mywebsite'
$protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';
$port = $_SERVER['SERVER_PORT'];
$disp_port = ($protocol == 'http' && $port == 80 || $protocol == 'https' && $port == 443) ? '' : ":$port";
$domain = $_SERVER['SERVER_NAME'];
$full_url = "${protocol}://${domain}${disp_port}${base_url}"; # Ex: 'http://example.com', 'https://example.com/mywebsite', etc.