Skip to content

Instantly share code, notes, and snippets.

View benoror's full-sized avatar
🌀
In a quantum state between coding and procrastinating

Ben Orozco benoror

🌀
In a quantum state between coding and procrastinating
View GitHub Profile
/**
* Terminal Animation snippet
* taken from:
* http://lotusrb.org/
* http://lotusrb.org/javascripts/application.js
**/
// Typing terminal animation
$(window).load(function(){
var version = $('meta[name=lotusrb-version]').attr('content');
Verifying that +benoror is my openname (Bitcoin username). https://onename.com/benoror
"schema": {
"type": "object",
"title": "CONTROLS_Basic",
"properties": {
"Id": {
"title": "Id",
"type": "string",
"required": true,
"maxLength": 10,
"format": "",
@benoror
benoror / gist:e7958edc34820d2b5e4d
Created May 14, 2015 18:32
input addon with templateManipulator (doesn't work)
.run(function config(formlyConfig) {
formlyConfig.templateManipulators.preWrapper.push(function(template, options, scope) {
var heritage = getHeritage(options.type);
if (heritage.indexOf('money') !== -1) {
console.log(options)
options.templateOptions.addonLeft = {
text: '$'
}
return 'THIS IS AN INPUT!' + template;
}
@benoror
benoror / formly-types.js
Last active August 29, 2015 14:21
angular-formly: custom types
'use strict';
/**
* Custom Templates for angular-formly
*/
angular.module('panaxuiApp')
.config(function config(formlyConfigProvider) {
/*
input
@benoror
benoror / async_select.html
Created May 18, 2015 15:50
angular-formly select
<ui-select ng-model="model[options.key]" theme="bootstrap" reset-search-input="false">
<ui-select-match>{{$select.selected[to.labelProp || 'name']}}</ui-select-match>
<ui-select-choices repeat="option in to.options | filter: $select.search">
<div ng-bind-html="option[to.labelProp || 'name'] | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
@benoror
benoror / async_select.html
Created May 19, 2015 23:23
UI-Select template for angular-formly
<ui-select ng-model="model[options.key]" theme="bootstrap" ng-required="{{to.required}}" ng-disabled="{{to.disabled}}" reset-search-input="false">
<ui-select-match placeholder="{{to.placeholder}}">
{{$select.selected[to.labelProp || 'name']}}
</ui-select-match>
<ui-select-choices group-by="to.groupBy" repeat="option[to.valueProp || 'value'] as option in to.options | filter: $select.search">
<div ng-bind-html="option[to.labelProp || 'name'] | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
@benoror
benoror / 0-old.js
Last active August 29, 2015 14:21
Node's MSSQL "ConnectionError: Connection is closed" before & after
// Calling this method a few times rapidly woudl casue ECONNCLOSED
Class.prototype.getCatalogOptions = function(args, callback) {
var that = this;
sql.connect(that.config.db, function (err) {
if (err)
return callback(err);
var sql_req = new sql.Request();
var sql_str = 'EXEC [$Table].getCatalogOptions @@userId=' + args.userId + ", @catalogName='" + args.catalogName + "', " +
@benoror
benoror / dirty-fields.js
Last active August 29, 2015 14:21
Getting $dirty fields from angular-formly
var dirtyFieldsIterator = function(obj, model) {
angular.forEach(obj, function (el) {
// fields
if(el.fields) {
fieldIterator(el.fields, model);
}
// fieldGroup
if(el.fieldGroup) {
// Nested model
if(el.model) { // Model $eval at runtime
@benoror
benoror / states.js
Created May 27, 2015 23:04
How to load a category when re-loading from browser?
/*
Main `abstract` root state
*/
.state('main', {
abstract: true,
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
/*
Home state