Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Enlow novaugust

View GitHub Profile
@novaugust
novaugust / Adding Disqus to a ghost blog on casper ~ 1.0
Last active Apr 29, 2020
Adding Disqus to a Ghost Blog running a Casper-based theme without editing any files
View Adding Disqus to a ghost blog on casper ~ 1.0
I noticed that there weren't any writeups for using code injection to add Disqus comments to a ghost blog. Everything assumes you're comfortable with editing your theme (and thus being responsible for maintaining a fork, urk).
So, I used the steps below to add to Disqus comments to my blog running a [Casper fork](https://github.com/novaugust/novasper). If your theme varies wildly from Casper, you'll be able to get by just by updating the css selectors in the javascript. If all that is a bit much for you, leave a comment and a link to your site and I'll give you what your versino of the code would be.
## Code Injection to the rescue
So! Here's the scoop
1. **Set up your disqus**. You're a grownup, you'll figure it out.
2. Go to your blog admin's **`Code Injection`** section (example.com/ghost/settings/code-injection/).
@novaugust
novaugust / mix.exs
Created Apr 22, 2015
Aliasing client tasks in your mix.exs
View mix.exs
defmodule Operator.Mixfile do
use Mix.Project
alias Mix.Utilities.Client
defp aliases do
# Deps.get can't be put into a KWL easily
[
release: [&Client.compile/1, "release"],
ember: [&Client.compile/1]
]
|> Keyword.put(:"deps.get", [&Client.get_deps/1, "deps.get"])
View gist:0c9503f16ad6798c8bc8
/**
* Tests the footnotes extension for showdown
*
*/
/*globals describe, it */
/*jshint expr:true*/
var should = require('should'),
// Stuff we are testing
@novaugust
novaugust / migration_notes.md
Created Feb 14, 2015
Ghost EAK -> Ember-cli migration notes
View migration_notes.md

1. The great migration. Move all client files to ember-cli funtimes.

cd core/client
git mv -k * app/
git mv ../server/views/default.hbs app/index.html
cd app
git mv -k assets/sass styles
git mv styles/screen.scss styles/app.scss
View ember-cli postBuild hook
var fs;
var RSVP;
function copyPromise (src, dest) {
return new RSVP.Promise(function (resolve, reject) {
fs.copy(src, dest, function (error) {
if (error) {
return reject(error);
}
return resolve();
});
@novaugust
novaugust / top30year.js
Created Aug 2, 2014
Top 30 contributors from the last year
View top30year.js
var SettingsAboutRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, loadingIndicator, {
model: function () {
var contributorUrl = 'https://api.github.com/repos/TryGhost/Ghost/contributors';
return ic.ajax.request(contributorUrl);
}
});
@novaugust
novaugust / Calculate contributors.js
Created Aug 2, 2014
Get the top 30 contributors between two releases as a model for ember.js
View Calculate contributors.js
var SettingsAboutRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, loadingIndicator, {
model: function () {
var contribStatsUrl = 'https://api.github.com/repos/TryGhost/Ghost/stats/contributors',
releasesUrl = 'https://api.github.com/repos/TryGhost/Ghost/releases',
from,
to;
return ic.ajax.request(releasesUrl).then(function (releases) {
//Divide by 1k to remove milliseconds: GH doesn't use them
from = Date.parse(releases[1].published_at) / 1000;
View gist:1df6b385a2b8d801591e
//in slug-generator.js
// in generateSlug():
// line 17...
return ic.ajax.request(url, {
type: 'GET'
}).then(function (response) {
return Ember.RSVP.Promise.reject(new Error('BOOM!'));
var slug = response.slugs[0].slug;
self.set('value', slug);
return slug;
View bound-one-way.js
var BoundOneWay = function (upstream, transform) {
if (typeof transform !== "function") {
transform = function (value){return value;};
}
return function (key, value) {
return arguments.length > 1 ? value : transform(this.get(upstream));
}.property(upstream);
};
You can’t perform that action at this time.