Skip to content

Instantly share code, notes, and snippets.

View DrewDahlman's full-sized avatar

Drew Dahlman DrewDahlman

View GitHub Profile
@DrewDahlman
DrewDahlman / .gitignore
Last active May 5, 2019 17:35
Sample gitignore
/wordpress/wp-content/themes/wp-content/uploads/*
/wordpress/wp-content/themes/rip-it/ ## THIS SHOULD BE YOUR THEME NAME
@DrewDahlman
DrewDahlman / config.js
Last active May 5, 2019 14:01
Gulp Config
var path = require("path");
// Set your theme name here
const THEME = "rip-it";
const PATH = "/app";
// Export config
module.exports = {
"port": "4000", // Port to run on
"root": path.resolve(`${PATH}/wp-content/themes/${THEME}`), // Where to serve from
@DrewDahlman
DrewDahlman / page-builder-template.php
Last active April 24, 2019 13:23
Sample ACF page builder switch statement
<?php
while( have_rows('page_content')): the_row();
switch(get_row_layout()){
case "copy_&_image":
include("blocks/copy.php");
break;
case "single_column":
include("blocks/single.php");
break;
case "image_gallery":
<?php
include_once(dirname(__FILE__) . "/s3.php");
class Uploader {
var $settings;
var $file;
public function __construct( $file_name, $tmp_file, $dest ){
$this->settings["bucket"] = get_site_option("tantan_wordpress_s3")["bucket"];
<?php
/*
------------------------------------------
| publish:void (-)
|
| Publishes the content
------------------------------------------ */
function publish(){
foreach( $this->settings["content"] as $content ){
<?php
/*
------------------------------------------
| parsePost:array (-)
|
| Parses a post object recursively.
|
| @post:obj - A wordpress post object
| @content:array - Array for content
| @nested:bool - Flag for 1 level deep nesting
[{
"ID": 16,
"post_author": "1",
"post_date": "2018-01-14 20:01:58",
"post_date_gmt": "2018-01-14 20:01:58",
"post_content": "",
"post_title": "X Files",
"post_excerpt": "",
"post_status": "publish",
"comment_status": "closed",
this._vl53l0x.setSignalRateLimit(.05, () => {
_this._vl53l0x.startCapture();
});
"use strict"
/*
Copyright (c) 2017. All Rights Reserved.
Author: Drew Dahlman - Legwork Studio.
VL53L0X API Wrapper ported to tessel. This acts as a simple wrapper for the VL53L0X Time Of Flight Sensor.
Ported from https://github.com/pololu/vl53l0x-arduino
/*
------------------------------------------
| setSignalRateLimit:bool (-)
|
| Set the return signal rate limit check value in units of MCPS (mega counts
| per second). "This represents the amplitude of the signal reflected from the
| target and detected by the device"; setting this limit presumably determines
| the minimum measurement necessary for the sensor to report a valid reading.
|
| Setting a lower limit increases the potential range of the sensor but also