Skip to content

Instantly share code, notes, and snippets.

View ZachMoreno's full-sized avatar

Zachariah Moreno ZachMoreno

View GitHub Profile
'use strict';
// server-side dependencies
var express = require('express'),
// mongodb orm
mongoose = require('mongoose'),
// parse response content
bodyParser = require('body-parser'),
// parse cookie content
cookieParser = require('cookie-parser'),
@ZachMoreno
ZachMoreno / js-library-scaffold.js
Last active August 29, 2015 14:13
JS Library Scaffold
var LibraryName = (function () {
var LibraryName = function LibraryName() {
}
// Todd Moto's forEach method
LibraryName.forEach = function forEach(array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]); // passes back stuff we need
}
@ZachMoreno
ZachMoreno / scroll-to-top-example.html
Created December 4, 2014 16:15
depends on jquery & animate.css
<!doctype html>
<html>
<head>
<title></title>
<style>
/* fab */
.fab {
height: 56px;
width: 56px;
<!doctype html>
<html>
<head></head>
<body>
<ol ng-repeat="day in root">
<li>{{ day.name }}
<ol ng-repeat="category in day.categories">
<li>{{ category.name }}
// forEach method, could be shipped as part of an Object Literal/Module
var forEach = function (array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]); // passes back stuff we need
}
};
// language-toggle
var activateEnglish = function () {
'use strict';
angular.module('appName.itemService', [])
.factory('Items', ['$resource', function($resource) {
return $resource('http://localhost:1337/api/v1/items/:id', {}, {
delete: {method: 'DELETE'}
});
}]);
@ZachMoreno
ZachMoreno / controller-example.js
Created July 28, 2014 14:11
Consume JSON endpoint with Angular Service/Factory & promises
'use strict';
/* Controllers */
angular.module('zm.controllers', [])
.controller('homeCtrl', ['$scope', function($scope) {
}])
.controller('journalCtrl', ['$scope', 'recentPostsFactory', function($scope, recentPostsFactory) {
@ZachMoreno
ZachMoreno / static-material.html
Created July 21, 2014 17:20
Google's Material Design in static form
<!doctype html>
<html>
<head>
<title>Zach Moreno Beta</title>
<!-- web fonts -->
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,400italic,300italic,100italic,500italic' rel='stylesheet' type='text/css'>
<!-- css -->
<link rel="stylesheet" type="text/css" href="style.css">
<ul>
<?php
$topThreePostsArgs = array(
'post_type' => 'coastal_news'
);
// Query the Coastal News post type -->
$my_query = new WP_Query( $topThreePostsArgs );
// While there are Coastal News items, loop through them as list items
while ($my_query->have_posts()) : $my_query->the_post();
// Don't show duplicates
@ZachMoreno
ZachMoreno / list.css
Created March 20, 2014 23:03
Continue ordered list item numbering with CSS counter
ol.start {
counter-reset: mainSection;
}
ol.split {
list-style-type: none;
}
ol.split li:before {
counter-increment: mainSection;