Skip to content

Instantly share code, notes, and snippets.

View thebigredgeek's full-sized avatar
💭
Considering new contract opportunities at this time

Andrew E. Rhyne thebigredgeek

💭
Considering new contract opportunities at this time
View GitHub Profile
@thebigredgeek
thebigredgeek / gist:6946437
Created October 12, 2013 06:19
weird bug
/**
* This controller is used by youtubeItem directives
* @name angulartodo#youtubeItemController
* @param {Object} $scope An instance of $scope
* @param {Object} $attrs An object containing html attributes bound to this directive
*/
angular.module('angulartodo').controller('youtubeItemController',[
'$scope','$attrs',
function($scope, $attrs){
console.log("hello world!");
var InheritableCleanObject = function(){
var publicMembers = this,
privateMembers = {};
publicMembers.hello = function(){
return "world";
};
InheritableCleanObject.prototype = publicMembers;
}
@thebigredgeek
thebigredgeek / QLite.js
Last active December 30, 2015 23:59
Simple Promise API
(function(scope){ //injected scope to bind
scope.QLite = {};
var publicMembers = scope.QLite, //bind publicMembers to the injected scope
privateMembers = {}; //private members hash for internal closure members
privateMembers.promise = function(){ //the promise object
var self = this,
queue = {};
@thebigredgeek
thebigredgeek / gist:9636284
Created March 19, 2014 06:04
quick little question
var fooList = function(){
var self = this,
data = [];
self.add = function(name){
data.push(name);
};
self.clearDeep = function(){
@thebigredgeek
thebigredgeek / dabblet.css
Created August 14, 2014 18:28
iOS 6 style switch checkboxes
/**
* iOS 6 style switch checkboxes
* by Lea Verou http://lea.verou.me
*/
:root input[type="checkbox"] { /* :root here acting as a filter for older browsers */
position: absolute;
opacity: 0;
}
angular.module('foo').directive('fileUpload', function($event){
return {
restrict: 'E',
scope: {
uploadEvent: '='
},
template: '<input type="file" style="display: inline-block; height: 100%; width: 100%"></input>',
link: function(scope, element){
var input = element.find('input');
element.css('display', 'inline'); //make sure the element itself behaves like an input visually so
@thebigredgeek
thebigredgeek / demo.js
Last active August 29, 2015 14:27
DS#loadRelations not working
'use strict';
angular.module('console').factory('Employer', function(DS, $rootScope){
var store = DS.defineResource({
name: 'Employer',
idAttribute: 'guid',
endpoint: '/employers',
keepChangeHistory: true,
schema: {
name: 'string',
@thebigredgeek
thebigredgeek / data.json
Created September 2, 2015 20:14
map/reduce - promises vs reactive programming
{
"data": [
{
"value": 1
},
{
"value": 2
},
{
"value": 3
var files = [
'javascript/foo.js',
'css/bar.css',
'images/hello.png',
'images/world.jpg'
];
var fileSends = files.map(function (filePath) {
//Loops over files, passing in file[index] as filePath
//It returns a new array based on whatever is returned from each function call
var files = [
'javascript/foo.js',
'css/bar.css',
'images/hello.png',
'images/world.jpg'
];
var fileSends = files.map(function (filePath) {
//Loops over files, passing in file[index] as filePath
//It returns a new array based on whatever is returned from each function call