A Pen by Jesse Hattabaugh on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
"use strict"; | |
var fs = require('fs'), | |
gw = require('globwatcher').globwatcher; | |
var cssw = gw('./source/*.styl', {persistent: true}); | |
cssw.on('added', function (filename) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
gulp.task('default', ['stylus']); | |
/* Stylus | |
-------------------------------------*/ | |
var stylus = require('gulp-stylus'); | |
var nib = require('nib'); | |
gulp.task('stylus', function() { | |
return gulp.src('source/*.styl') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (chai, utils) { | |
var Assertion = chai.Assertion; | |
Assertion.addMethod('setsGets', function (val) { | |
var method = this._obj; | |
// setter/getters must be functions | |
new Assertion(method).to.be.a('function'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Images | |
******************************************************************************/ | |
gulp.task('images', function() { | |
// batch mode | |
watch({glob: './source/images/*'}) | |
.pipe(plumber()) | |
.pipe(imagemin({ | |
progressive: true, | |
interlaced: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Esplaination | |
**************************************************************************** | |
This include represents a pattern for handling fonts which I have settled on after a lot of time | |
struggling to get fonts to render consistently across browsers. The jist of it is this; I don't | |
use font-weight or font-style. Instead I use a different font-family for each variation of the | |
font (ie. font-family: "FiraSans-Regular"; font-family: "FiraSans-BoldItalic"). The reason I do | |
this is that browsers don't always use the appropriate @font-face even when you declare them | |
with font-weight and font-size. This method allows me to control EXACTLY which font file is used. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_analyze_terms(){ | |
printp("total:",storage.site.terms) | |
storage.terms.sort(lastAnalyzed).limit(40).forEach(function(t){ | |
t.volume = (100 / storage.site.count) * t.count | |
if(t.volume > 0.1) t.relevant = false | |
else if(t.volume < 0.008) t.relevant = false | |
else t.relevant = true | |
storage.interests.filter({term:t}).forEach(function(i){ | |
i.volume = (100 / i.user.count) * i.count | |
i.difference = i.volume - t.volume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cron_analyze_users(){ | |
var subject = storage.users.sort(lastAnalyzed).first() | |
var interests = [] | |
storage.interests.filter({user:subject,relevant:true}).forEach(function(i){ | |
interests[i.term.string] = i.difference | |
}) | |
var analyzed = [] | |
storage.relations.filter({subject:subject}).forEach(function(r){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function niceDate(date) { | |
if(typeof date == 'object') { | |
if(Date.today().compareTo(date) == -1) return 'today' | |
else if(Date.today().add({days:-1}).compareTo(date) == -1) return 'yesterday' | |
else return date.toString('MM/dd/yy') | |
} else return '02/24/82' | |
} | |
function niceTime(date) { | |
if(typeof date == 'object') { | |
if(date > (1).minutes().ago()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cron_refresh(){ | |
storage.feeds.sort(stale).limit(5).forEach(function(feed){ | |
var loadedFeed = loadFeed(feed.url) | |
// here would be a good place to update the rest of the feed's fields in case they've changed | |
var entries = loadedFeed.entries | |
var n=0 | |
for(var i=0; i<entries.length; i++){ | |
var someEntry = storage.entries.filter({feed:feed, title:entries[i].title}).first() | |
if(!someEntry) { | |
var published = parseDate(entries[i].publishedDate) |
OlderNewer