Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am aweigold on github.
  • I am weigold (https://keybase.io/weigold) on keybase.
  • I have a public key ASAb_1RI8NanhU7ECEJ9Y9Y4aqdosflDQqoFBBUGa2idDgo

To claim this, I am signing this object:

@aweigold
aweigold / change-window-location-on-error-page-ui-router-state-change.js
Created October 16, 2016 22:19
Listens to ui-router for state changes and changes the window location if the current page is an error page.
$rootScope.$on('$stateChangeStart', function(evt, to, params){
var isError = $windowProvider.$get().document.querySelector("meta[name='yourErrorPageTag']");
if (isError) {
evt.preventDefault();
$windowProvider.$get().location = "/apppath/index.html" + $windowProvider.$get().location.hash;
}
});
@aweigold
aweigold / base-fragement-for-error-pages.html
Created October 16, 2016 22:14
base.html fragment file for supporting error pages.
<meta name="yourErrorPageTag" content="true" />
<base href="/apppath/" />
@aweigold
aweigold / grunt-templtated-index-with-errorpages-base.html
Created October 16, 2016 22:10
Templated index.html file for supporting error pages.
<!-- build:include:error404,error404 error/base.html --><!-- /build-->
@aweigold
aweigold / grunt-templtated-index-with-errorpages.html
Created October 16, 2016 22:03
Templated index.html file for supporting error pages.
<div class="page-container">
<div class="site-content">
<!-- build:remove:error400,error404 -->
<div ui-view="mainBody"></div>
<!-- /build -->
<!-- build:include:error400 error/400.html --><!-- /build-->
<!-- build:include:error404 error/404.html --><!-- /build-->
</div>
</div>
@aweigold
aweigold / grunt-processhtml-errorpage-targets.js
Created October 16, 2016 21:59
Grunt processhtml errorpage targets example
// 'paths' is setup earlier in my grunt file
processhtml: {
mainapp: {
options: {
strip: true,
data: {
year: new Date().getFullYear(),
localCssPath: paths.minCssName,
localJsPath: paths.minJsName
}
@aweigold
aweigold / gist:6def1e8f31dfc2f86b46
Created July 20, 2015 09:08
Command parameter for boost test to run single test/suite
--run_test=<test_name>
@aweigold
aweigold / .travis.yml
Created March 29, 2015 21:17
Launching the gradle site plugin and a bash script on build success with travis ci.
language: java
after_success:
- "./gradlew jacocoTestReport coveralls"
- "./gradlew groovydoc buildSite"
- ".travis/deploy_ghpages.sh"
env:
global:
- GH_REF: github.com/aweigold/lemming.git
- secure: abcAB.....
@aweigold
aweigold / deploy_ghpages.sh
Created March 29, 2015 21:13
Deploying your gradle site output to gh-pages from travis-ci
#!/bin/bash
cp -Rvf build/resources/site gh-pages
cd gh-pages
git init
git config user.name "travis-ci"
git config user.email "travis@travis-ci.org"
git add .
git commit -m "Publishing site from Travis CI build $TRAVIS_BUILD_NUMBER"
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
echo "Published site to gh-pages. See http://aweigold.github.io/lemming"
@aweigold
aweigold / index.html
Created March 29, 2015 21:05
Injecting your rendered markdown into your page with marked and highlight.js
<script type="text/javascript">
var req = new XMLHttpRequest();
req.onload = function() {
var markdownString = this.responseText;
marked.setOptions({
highlight: function (code, lang) {
if (lang == undefined){
return code;
}