Skip to content

Instantly share code, notes, and snippets.

(function () {
'use strict';
/* globals _*/
/* - API access prettifier and standardizer
* we use this service heavily to take some of the pain out of writing api calls all the time.
* it wraps the native angular $http method. It'd be a simple task to write a non-angular specific
* version of this though.
*
* - Sample Usage:
* apiService.users(42).report(18).put({'sample': 'json'}).then(function(response){
@jabyrd3
jabyrd3 / alerts.js
Last active January 4, 2016 22:31
angular simple alerts
(function () {
'use strict';
/* globals _ */
/*
* dismissable alert service
* - purpose
* this directive and service combo provide a reusable method of popping dismissable
* notifications for succesful submissions, errors, warnings, ad nauseam.
*
* - usage
this.dimensions = function () {
return _.chain(points)
.filter(function (item) {
if (item !== 'Z') {
return item;
}
})
.map(function (point) {
var command = point[0];
point = point.substr(1, point.length)
@jabyrd3
jabyrd3 / gist:412d6b75ec236854705c
Last active June 17, 2016 01:34
stupid directive to add directives to an element for automatically building UI components
(function () {
'use strict';
/* globals _ */
angular.module('application')
.directive('dynamicDirectives', ['$compile', function ($compile) {
return {
restrict: 'A',
scope: true,
transclude: false,
link: function (scope, elem, attr) {
//ip5: 86.9;
//ip6: 88.75;
//ip6p: 90.2;
.calc(@diff) {
.vhCalc(@input) {
@vh: (@input * @diff) / 100vh;
}
.calcHeader(@inpot) {
.vhCalc(@inpot);
@headerHeight: @vh;
@jabyrd3
jabyrd3 / spinButton.js
Last active August 29, 2015 14:24
quickie directive for buttons
(function () {
'use strict';
/**
<button class="custom"
title="approve"
spin-button
ng-click="approve()"
ng-if="cached.IsApprove"
ng-class="currentItem.asset.RatedOnDateTime ? 'custom approve filled' : 'custom'"
toggle-condition="currentItem.asset.RatedOnDateTime"
@jabyrd3
jabyrd3 / ugh.js
Created June 5, 2014 15:48
ugh.js
{
"errorCode": 0,
"errorDesc": null,
"Header": {
"Key": {
"Type": "Attribute",
"Title": "FullName",
"Dimension": "Agent"
},
"Value": {
@jabyrd3
jabyrd3 / services.js
Created June 4, 2014 01:06
Quick db abstract for working with cordova / AngularJS
/* Services */
var myApp = angular.module('myApp.services', []);
myApp.service('DB', function($window) {
//var query = 'SELECT DISTINCT(prod_category) FROM prod_master';
var dbConn = $window.sqlitePlugin.openDatabase({
name: "hd_app.sqlite"
});
var chewer = function(tx, res, callback) {
@jabyrd3
jabyrd3 / exampleHeader.json
Last active August 29, 2015 14:01
pisswizard
"Header":{
"Key":{
"Type":"Attribute",
"Title":"BoardName",
"Dimension":"Broker"
},
"Value":{
"Key":{
"Type":"Attribute",
"Title":"BrokerName",
@jabyrd3
jabyrd3 / say.js
Created May 12, 2014 19:56
say a frasier
var util = require('util');
var fs = require('fs');
var markov = require('markov');
function theCleaner(theText) {
if (theText.slice(-1) !== ('!' || '?' || '.')) {
theText = theText.slice(0, theText.length - 1);
theText += '.';
}