Skip to content

Instantly share code, notes, and snippets.

View asha23's full-sized avatar
🎩
Working from home

Ash Whiting asha23

🎩
Working from home
View GitHub Profile
@asha23
asha23 / import_files.php
Created August 29, 2019 13:17 — forked from teledirigido/import_files.php
Create post, add attachment and update field via ACF
<?php
/*
*
* This small scripts creates a post and attaches a file using Advanced custom field.
*
* Created by Miguel Garrido
* miguel.co.nz | [email protected]
*
* Notes:
@asha23
asha23 / progress.php
Created August 29, 2019 10:06 — forked from mjuhl/progress.php
PHP Output Buffering/JavaScript/CSS Transition Progress Bar Experiment
<?php
/* For AJAX, if frustrated, try the following (see http://www.php.net/manual/en/function.flush.php#91556):
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
*/
ob_start();
set_time_limit(0); // for scripts that run really long
function force_flush ($add_whitespace = TRUE) {
// NAV TOGGLER
// =======================================================
$(".navbar-toggle-custom").click(function () {
$(this)
.children("div")
.toggleClass("active");
$(this).toggleClass("active");
});
@asha23
asha23 / matchHeight.js
Created August 9, 2019 10:23
Match Height of element
function matchHeight(className, addOffset, repeat) {
var getDivs = document.querySelectorAll(className);
var arrayLength = getDivs.length;
var heights = [];
for (var i = 0; i < arrayLength; i++) {
heights.push(getDivs[i].offsetHeight);
}
@asha23
asha23 / core-blocks.txt
Created June 17, 2019 10:46 — forked from DavidPeralvarez/core-blocks.txt
Gutenberg core blocks list
// Útil para filtros de Gutenberg como "allowed_block_types"
archives
audio
button
categories
code
column
columns
coverImage
@asha23
asha23 / nginx.conf
Last active October 28, 2019 10:05
Default Nginx configuration file
server {
listen 80;
listen 443 ssl http2;
server_name .core.test;
root "/home/vagrant/code/test/web";
index index.html index.htm index.php;
charset utf-8;
@asha23
asha23 / nginx.conf
Last active October 28, 2019 10:04
Nginx WordPress outside root configuration
server {
listen 80;
listen 443 ssl http2;
server_name test.core;
root "/home/vagrant/code/test/web";
index index.html index.htm index.php;
charset utf-8;
@asha23
asha23 / fizzbuzz.php
Created March 16, 2019 00:12
Congratulations. You've done your due dilligence and realised that I can write code.. Don't make me do this as a code test. I'll just post this link.
<?php
function fizzBuzz() {
foreach (range(25,250) as $i):
$out = "";
if ($i % 7 == 0):
$out .= "Fizz ";
endif;
if ($i % 5 == 0):
$out .= "Buzz ";
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];
@asha23
asha23 / Web_Dev_Contract.md
Last active May 2, 2019 01:55
The latest version of my ‘killer contract’ for web designers and developers

Web Contract

Between [company name]

And [customer name].

Summary: