Skip to content

Instantly share code, notes, and snippets.

View raidenz's full-sized avatar

raidenz raidenz

View GitHub Profile
@raidenz
raidenz / README.md
Created February 21, 2018 02:47
Sequelize + Express + Migrations + Seed Starter
@raidenz
raidenz / express-server-side-rendering.md
Created May 6, 2017 16:30 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@raidenz
raidenz / sync.js
Created May 1, 2017 16:41
coroutines
var co = require('co');
var proc = require('child_process')
function exec(command) {
var p = new Promise(function (resolve, reject) {
proc.exec(command, function (err, stdout, stderr) {
if (err) {
console.log(stderr);
} else {
console.log(stdout)
@raidenz
raidenz / README.md
Created April 22, 2017 11:30 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)
@raidenz
raidenz / gitflow-breakdown.md
Last active July 10, 2017 05:32 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
x git commit --allow-empty -m "Initial commit"
x git checkout -b develop master

Connect to the remote repository

@raidenz
raidenz / ion-tabs-swipable.js
Created October 31, 2016 03:35 — forked from taivo/ion-tabs-swipable.js
Swipe navigation for ion-tabs (for ionic framework v 1.0.0)
angular.module('yourModule')
.directive('tabsSwipable', ['$ionicGesture', function($ionicGesture){
//
// make ionTabs swipable. leftswipe -> nextTab, rightswipe -> prevTab
// Usage: just add this as an attribute in the ionTabs tag
// <ion-tabs tabs-swipable> ... </ion-tabs>
//
return {
restrict: 'A',
require: 'ionTabs',
@raidenz
raidenz / Car.php
Created August 25, 2016 15:42 — forked from jgrossi/Car.php
How to use Eloquent (from Laravel) inside Wordpress
<?php // File location: /wp-content/themes/my-theme/src/Models/
namespace App\Models;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Car extends Eloquent
{
protected $table = 'cars';
protected $primaryId = 'id';
@raidenz
raidenz / README.md
Created March 20, 2016 06:03 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@raidenz
raidenz / gist:d8cefbe2cb472c9b30b2
Created November 26, 2015 02:24 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@raidenz
raidenz / boilerplate-widget.php
Created September 25, 2015 07:20 — forked from eddiemoya/boilerplate-widget.php
WordPress Boilerplate Widget
<?php /*
Plugin Name: Boilerplate Widget
Description: Starting point for building widgets quickly and easier
Version: 1.0
Author: Eddie Moya
/**
* IMPORTANT: Change the class name for each widget
*/
class Boilerplate_Widget extends WP_Widget {