View index.js
const devonly = function(plugin, options) {
if (process.argv.length > 2 && process.argv.indexOf('dev') > 0) {
return plugin(options);
}
else {
return function(files, metalsmith, done) {
done();
};
}
};
View hacky_array_selector.html
---
model:
conferences: conferences
this_conf: berlin
---
<ul>
{% for conference in model.conferences %}
<li>
View selenium_execute_script.py
if on_device:
# this event tells input's javascript that we
# are on fennec and came via a feedback prompt
fire_event = ('var e = document.createEvent("Events");'
'e.initEvent("FeedbackPrompted", true, false);'
'document.dispatchEvent(e);')
self.selenium.execute_script(fire_event)
View example.js
// doesn't work: frontmatter isn't substituted for template tags
.use(inplace({
engine: 'nunjucks',
pattern: '*.html',
directory: './source/extra_dir'
}))
// doesn't work: throws a template error on build
.use(inplace({
engine: 'nunjucks',
View get_ga_data.R
query.list <- Init(start.date = "2015-11-03",
end.date = "2015-12-14",
metrics="ga:users,ga:sessions,ga:goal1ConversionRate,ga:goal2ConversionRate,ga:goal3ConversionRate,ga:bounceRate,ga:goal3Completions",
dimensions = "ga:date,ga:browser,ga:browserVersion,ga:eventLabel,ga:eventCategory,ga:source",
max.results = 10000,
sort = "-ga:users",
table.id = table.id)
ga.query <- QueryBuilder(query.list)
return(GetReportData(ga.query, token, split_daywise = T))
View foo.bash
export version=2.7.11 && wget -q https://docs.python.org/2/archives/python-$version-docs-text.zip && unzip -qu python-$version-docs-text.zip && egrep -Ihor "python -m \w+" python-$version-docs-text | sort | uniq
View toungescraper.py
# go here: https://github.com/hoosteeno/tounguescraper/blob/master/tounguescraper.py
View tinker_ks.js
<%
tinker = function(path) {
var text = template('page', '/en-US/docs/Web');
text += "<p>I'M IN UR HTML ADDNG NOO MARKUPZ!</p>";
return text;
}
%>
<%-tinker('/en-US/docs/Web')%>
View get_profile_url_bio.sql
select
url, count(wiki_revision.id) as revision_count, bio,
concat('https://developer.mozilla.org/en-US/profiles/', username) as profile_page
from
(select substring(
misc
from (
/* start substring after but not including website key */
locate('"website": ', misc) + 12
)
View surbl_lookup.py
from surblclient import surbl
print 'freecreditreportblog.net' in surbl
print 'garagedoorrepairslandolakesfl.com' in surbl
print 'foo.bar.test.surbl.org' in surbl