Skip to content

Instantly share code, notes, and snippets.

Chris Seckler zeckdude

Block or report user

Report or block zeckdude

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zeckdude
zeckdude / es7-async-await.js
Created Oct 13, 2018 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
View es7-async-await.js
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
View base 64
/9j/4AAQSkZJRgABAQEASABIAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/+EAQEV4aWYAAE1NACoAAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAAwygAwAEAAAAAQAAAkQAAAAA/9sAQwAEAwMEAwMEBAQEBQUEBQcLBwcGBgcOCgoICxAOEREQDhAPEhQaFhITGBMPEBYfFxgbGx0dHREWICIfHCIaHB0c/9sAQwEFBQUHBgcNBwcNHBIQEhwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc/8AAEQgCRAMMAwEiAAIRAQMRAf/EAB0AAQACAgMBAQAAAAAAAAAAAAAGBwUIAQMEAgn/xABZEAABAwICBQYIBw0GBAYBBQEBAAIDBAUGEQcSITFBE1FhcYGRFBUiMlKhscEIQmJykpPRFhgjMzQ1Q1NVc4LS4RdUorLC0yRjg/AlRGSUo+KzJjZGdKTx/8QAHAEBAAEFAQEAAAAAAAAAAAAAAAYBAgMEBQcI/8QAPxEAAgEDAQUECQIFBAIBBQAAAAECAwQRBQYSITFRE0FhcRQiMoGRobHB0QdSFSNC4fAWM1PxNGJyJENEkqL/2gAMAwEAAhEDEQA/ANnERFJSKBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBERAEREARE
@zeckdude
zeckdude / conditionalwrap.js
Created Aug 7, 2018 — forked from kitze/conditionalwrap.js
one-line React component for conditionally wrapping children
View conditionalwrap.js
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
View help_with_backbone_views_events.js
// Handling events in a View
var SongView = Backbone.View.extend({
events: {
"click button": "onClick", // Run the "onClick" function when the any button is clicked
"click button.bookmark": "onClickBookmark", // Run the "onClickBookmark" function when the a button with the class "bookmark" is clicked
"click input[type=button]": "doSomething" // Shows that you can include the same types of selectors as in jQuery
},
onClick: function() {
console.log("Listen clicked");
@zeckdude
zeckdude / backbone_from_scratch_chapter_collections.js
Created Dec 3, 2015
Backbone from Scratch Chapter Project: Collections
View backbone_from_scratch_chapter_collections.js
// BACKBONE COLLECTIONS PROJECT
console.log("Begin - BACKBONE COLLECTIONS PROJECT");
// Create a Backbone collection for the Vehicle model you created in the last project.
var Cars = Backbone.Collection.extend({
model: Vehicle
});
// Add the following cars inside the collection:
// * car1: { registrationNumber = “XLI887”, colour = “Blue” }
@zeckdude
zeckdude / backbone_from_scratch_chapter_models.js
Last active Dec 3, 2015
Backbone from Scratch Chapter Project: Models
View backbone_from_scratch_chapter_models.js
// BACKBONE MODELS PROJECT
console.log("Begin - BACKBONE MODELS PROJECT");
// Create a Backbone model for a Vehicle.
// A Vehicle is uniquely identified via one of its attributes called “registrationNumber”, which cannot be null or undefined.
// Vehicles can be retrieved from the server at “/api/vehicles”.
// A Vehicle should have a method called start(), which logs a message in the console: “Vehicle started.”
var Vehicle = Backbone.Model.extend({
idAttribute: "registrationNumber",
urlRoot: "/api/vehicles",
View Results
This says that when we visit http://you.rock/stringhelpers, we’ll initialize a basic string which will contain the text We like to program in PHP and we like to use the Laravel Framework! Then we’ll call our helper functions via static methods and var_dump the result to the screen.
string 'We like to program in PHP and we like to use the Laravel Framework!' (length=67)
string 'like to program in PHP and we like to use the Laravel Framework!' (length=64)
string 'We like to ' (length=11)
string 'like to program' (length=15)
@zeckdude
zeckdude / CMailGunLogRoute.php
Created Jan 7, 2014
Extending Yii CEmailLogRoute class using Mailgun
View CMailGunLogRoute.php
<?php
// components/CMailGunLogRoute.php
class CMailGunLogRoute extends CEmailLogRoute {
protected function sendEmail($email, $subject, $message) {
$mail = Yii::app()->mailgun->newMessage();
$mail->setFrom($this->getSentFrom());
$mail->addTo($email);
$mail->setSubject($subject);
$mail->setText($message);
You can’t perform that action at this time.