Skip to content

Instantly share code, notes, and snippets.

View pmanijak's full-sized avatar
📷

Philip Manijak pmanijak

📷
  • Olympia, Washington
View GitHub Profile
@pmanijak
pmanijak / index.html
Created September 2, 2012 06:42
Service example with AngularJS for sharing scope data between controllers
<!doctype html>
<html ng-app="project">
<head>
<title>Angular: Service example</title>
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<script>
var projectModule = angular.module('project',[]);
projectModule.factory('theService', function() {
return {
@pmanijak
pmanijak / image-overlay.html
Created March 31, 2020 09:56
HTML and JavaScript client-side image overlay and download
<html>
<head>
<!-- https://html2canvas.hertzen.com/ -->
<script src="html2canvas.min.js"></script>
<script>
function previewFile() {
const preview = document.querySelector('#client-image');
const file = document.querySelector('input[type=file]').files[0];
const reader = new FileReader();
@pmanijak
pmanijak / Auto-deploy with git on Webfaction
Last active August 1, 2018 03:25
Setting up a simple auto-deploy with git on Linux
On server
-----------------
# make a git repo
$ mkdir /path/to/repo.git
$ cd /path/to/repo.git
$ git init --bare
# make a post-receive hook
# see the post-receive file in this Gist
# if you're using Node.js
@pmanijak
pmanijak / include.html
Created September 1, 2012 19:55
Minimal template example with AngularJS
:-)
@pmanijak
pmanijak / directive-template.js
Last active April 24, 2016 20:42
Angular directive that works with other directives
// A basic template for Angular directives
// that work with other directives.
'use strict';
angular.module('ModuleName.directives')
.directive('myDirective', ['$timeout', 'serviceDependency',
function ($timeout, serviceDependency) {
// Directives accept dependencies in the typical
// Angular way. Be aware that you cannot put
// $scope or $element above -- they belong either
@pmanijak
pmanijak / index.html
Created September 4, 2014 01:30
Using Angular ng-model with server-side templates
<html ng-app="project">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script>
// Create your module
var dependencies = [];
var app = angular.module('project', dependencies);
// Create a 'defaults' service
app.value("defaults", /* your server-side JSON here */);
// e.g. { whatever: 'some default text' }
@pmanijak
pmanijak / Smooth Ghost fonts on Windows
Last active December 31, 2015 20:59
Custom style sheet for using Ghost on Chrome on Windows, for smoothing out the fonts.
Place in '${chromeProfilePath}\User StyleSheets\Custom.css'
@pmanijak
pmanijak / .Git-aware prompt
Last active December 20, 2015 08:39
git prompt setup
# Instructions: https://github.com/jimeh/git-aware-prompt
# Also see: http://www.ibm.com/developerworks/linux/library/l-tip-prompt/
@pmanijak
pmanijak / CouchDB return HTTP 304 for attachments
Last active December 19, 2015 18:09
Get CouchDB to return HTTP 304 when getting attachments, using Express and Nano on Node.js.
:-)
@pmanijak
pmanijak / iisnode with express web.config file
Last active December 19, 2015 08:29
iisnode with express web.config file
:-)