Skip to content

Instantly share code, notes, and snippets.

🤠
Just hackin' away!

blake schwartz bschwartz757

View GitHub Profile
@bschwartz757
bschwartz757 / solutions.js
Last active May 11, 2018
Parallel async function examples and string search examples
View solutions.js
/////// FETCH URLS ASYNCHRONOUSLY ///////////
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
//interesting (opinionated) article on fetch vs. xhr: https://jakearchibald.com/2015/thats-so-fetch/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
@bschwartz757
bschwartz757 / async.js
Last active Apr 8, 2019
Async/await function to fetch data from multiple URLs in parallel
View async.js
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@bschwartz757
bschwartz757 / strings.js
Last active May 11, 2018
String/RegExp search methods
View strings.js
<div id="placeholder">
Output goes here
</div>
const string = 'there is a cow in a field';
function print(result) {
console.log(result);
document.getElementById('placeholder')
.innerText = result;
View profile.php
<?php
/**
* controllers/Profile.php
*
* Profile list page for Gig Central
*
* @package ITC260
* @subpackage Profile_list
* @author Doug Doner
* @version 1.0 2015/05/14
View front-page.php
<?php
/**
* Template Name: Home Page
*
* @package WordPress
* @subpackage TheWishingWellWA
* @since TheWishingWellWA 1.0
*/
?>
<?php get_header(); ?>
@bschwartz757
bschwartz757 / ci-news-controller-snippet.php
Created Nov 23, 2015
CodeIgniter News Controller for Annotation
View ci-news-controller-snippet.php
<?php
//News.php
class News extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('news_model');
$this->config->set_item('banner', 'News Banner');
@bschwartz757
bschwartz757 / ci-rss-snippet.php
Created Nov 23, 2015
CodeIgniter Rss Snippet for Annotation
View ci-rss-snippet.php
<?php
$this->load->view($this->config->item('theme') . 'header');
?>
<div id="main">
<?php foreach ($rss->channel->item as $rss_item): ?>
<h3><?php echo $rss_item->title ?></h3>
<div>
<?php echo $rss_item->description ?>
@bschwartz757
bschwartz757 / sweet-lo-layout-snippet.css
Last active Apr 9, 2017
Custom Layout Snippet for Annotation - Sweet Lo
View sweet-lo-layout-snippet.css
@charset "utf-8";
/* CSS Document */
/* RESETS */
body, body * {
margin:0;
padding:0;
box-sizing: border-box; /* declared width = rendered width */
@bschwartz757
bschwartz757 / damn-right-layout-snippet.css
Last active Apr 9, 2017
Custom Layout Snippet for Annotation - DamnRight
View damn-right-layout-snippet.css
@charset "utf-8";
/* CSS Document */
/* RESETS */
body, body * {
margin:0;
padding:0;
box-sizing: border-box; /* declared width = rendered width */
}
@bschwartz757
bschwartz757 / index.html
Created Nov 20, 2015
My portfolio page
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
You can’t perform that action at this time.