Skip to content

Instantly share code, notes, and snippets.

@jhines2k7
jhines2k7 / sticky-tail-headers-with-different-heights-using-sticky-shortcuts.js
Last active August 29, 2015 14:25
Sticky tail headers with different heights using the Sticky shortcut class
var tailHeaders = $('.tail-header');
for(var i = 0; i < tailHeaders.length; i++) {
new Waypoint.Sticky({
element: tailHeaders[i],
context: $('#container'),
handler: function(direction) {
var prevTailHeader = this.waypoint.previous() ? this.waypoint.previous().adapter.$element : null;
var nextTailHeader = this.waypoint.next() ? this.waypoint.next().adapter.$element : null;
@jhines2k7
jhines2k7 / emmet-expansion-sample
Last active August 29, 2015 14:25
Emmet expansion sample
<!-- this Emmet snippet -->
.tail*20>div>.tail-header{Tail Header $$}+(p>lorem)+(p>lorem)
<!-- Generates this expansion -->
<div class="tail">
<div>
<div class="tail-header">Stuff</div>
<p>Aperiam commodi dolore dolorum eligendi esse et ex expedita magni, modi nam odio placeat sit temporibus
totam voluptatem. Ab adipisci deleniti dicta esse, explicabo hic neque omnis quae reiciendis sit.
@jhines2k7
jhines2k7 / simple-async-service.js
Created July 20, 2015 20:24
Simple Async Service AngularJS
angular.module('dep2', [])
.factory('ServiceTwo', function($q, $timeout){
var timeStamp;
return {
getTimeStamp: function(){
var defer = $q.defer();
if(typeof timeStamp === 'undefined'){
$timeout(function(){
@jhines2k7
jhines2k7 / async-data-controllers-dependencies.js
Created July 20, 2015 22:19
Angular async data, controllers and dependencies
<script>
angular.module('main', ['dep1', 'dep2'])
.controller('Controller1', function($scope, ServiceOne, ServiceThree){
$scope.fromService = ServiceOne.publicStuff;
ServiceThree.getServiceThreeData().then(function(data) {
$scope.fromServiceThree = data;
});
})
@jhines2k7
jhines2k7 / gulp-livereload-example.js
Last active August 29, 2015 14:25
Gulp live reload example
var gulp = require('gulp');
function startExpress() {
var express = require('express');
var app = express();
app.use(require('connect-livereload')());
app.use(express.static(__dirname));
app.listen(8080);
}
@jhines2k7
jhines2k7 / angular-ui-router-nested-views.js
Created July 23, 2015 18:44
An example of using AngularUI router with nested views with a resolve
<script>
angular.module('main', ['ui.router'])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url: '/home',
resolve: {
filterData: function(){
return [1, 2, 3, 4, 5, 6]
},
@jhines2k7
jhines2k7 / sample-karma-config.js
Last active August 29, 2015 14:25
Sample Karma configuration file
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
@jhines2k7
jhines2k7 / waypoints-with-one-sticky-tail-header-and-refresh-on-click.html
Created July 23, 2015 20:32
Waypoints with one sticky tail header and refresh on click
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Waypoints Elements Different Heights</title>
<style>
html, body {
height: 100%;
margin: 0;
@jhines2k7
jhines2k7 / emmet-expansion-with-an-offset.html
Created July 23, 2015 20:40
Emmet expansion with an offset
div{Number $@20}*5
@jhines2k7
jhines2k7 / waypoints-sticky-headers-with-handlebars.html
Created July 23, 2015 21:53
Waypoints Sticky headers with handlbars
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Waypoints Elements Different Heights</title>
<style>
html, body {
height: 100%;
margin: 0;