Skip to content

Instantly share code, notes, and snippets.

View Hendrixer's full-sized avatar

Scott Moss Hendrixer

View GitHub Profile
@Hendrixer
Hendrixer / routes.coffee
Last active February 7, 2022 07:39
Forgot password feature with Node, Epxress, Mongo
# for API and DB endpoints
user = require './controllers/userController'
mainFeed = require './controllers/mainFeedController'
{isLoggedIn} = require './middleWare'
{alreadyLoggedOut} = require './middleWare'
module.exports = (app, passport) ->
#=========================
# Routes here!!
@Hendrixer
Hendrixer / Gulpfile.js
Last active June 7, 2022 14:42
Gulpfile with Livereload, Nodemon, and other features
var gulp = require('gulp'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
server = require('tiny-lr')(),
refresh = require('gulp-livereload'),
mocha = require('gulp-mocha'),
stylus = require('gulp-stylus'),
notify = require('gulp-notify'),
nodemon = require('gulp-nodemon'),
jshint = require('gulp-jshint'),
@Hendrixer
Hendrixer / resolve.js
Created May 19, 2014 01:59
angular resolve
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/', {
controller: 'mainController',
templateUrl: '/templates/main.html'
resolve: {
users: function(hrFactory) {
return hrFactory.get('/users').then(function(data){
return data.data
})
<link rel="import" href="../paper-progress/paper-progress.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@Hendrixer
Hendrixer / directives.js
Created February 14, 2015 02:41
intro to directives
// Directives are easy
// Two types
// * attribute that adds functionality to an element (think jquery shit)
// * component (think custom element)
// follow below
angular.module('directives', [])
// ----------------- LEVEL ONE ------------------------------
// this directive will be an attribute directive
// we'll add functionality to an element
// lets change some css when clicked
@Hendrixer
Hendrixer / common.js
Last active August 29, 2015 14:15
angular + es6 + jspm + system.js: directive subclassing
import angular from 'angular';
import _ from 'lodash';
let template = `
<div>
<h1>{{ data.title }}</h1>
<div ng-transclude></div>
</div>
`;
@Hendrixer
Hendrixer / resolve.js
Created June 15, 2015 19:18
using resolve with components ng
angular.module('app', ['ui.router'])
.config(function($stateProvider){
$stateProvider
.state('app', {
url: '/app',
resolve: {
// DataService must be a valid dependecny somewhere
// user any valid service
// data will be the name of the resolved value
data: function(DataService /*, $http, $log, */){
@Hendrixer
Hendrixer / app.js
Created July 31, 2015 21:36
ng-teach
angular.module('app', [])
.controller('AppController', function($scope, Todos, Reddit) {
Reddit.getFrontPage()
.then(function(posts) {
$scope.redditPost = posts;
})
$scope.newTodo = '';
$scope.todos = Todos.getState();
$scope.createTodo = function() {
@Hendrixer
Hendrixer / app.js
Created December 3, 2015 20:56
using resolve with components
angular.moudle('app', [])
.config($stateProvider => {
$stateProvider
.state('profile', {
url: '/profile',
template: '<profile-page profile="profile"></profile-page>',
controller(profile, $scope){ // use 'function' if minifying
$scope.profile = profile;
},
resolve: {