Skip to content

Instantly share code, notes, and snippets.

@telagraphic
telagraphic / 0_reuse_code.js
Created August 13, 2014 13:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@telagraphic
telagraphic / app.js
Created July 24, 2014 14:31
getting correct params for rails to process
'use strict';
angular.module('offcampustest', ['ngRoute', 'ngResource', 'angularFileUpload'])
.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl:'/templates/rentals.html',
controller: 'RentalsCtrl'
}
)
// web.js
var express = require("express");
var logfmt = require("logfmt");
var app = express();
app.use(logfmt.requestLogger());
app.get('/', function(req, res) {
res.send('Hello World!');
});
@telagraphic
telagraphic / app.js
Last active August 29, 2015 13:56
XMLHttpRequest cannot load http://api.wunderground.com/api/9534fdd6bc6642cd/forecast/q/OH/Columbus.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.
'use strict';
angular.module('weatherBetterApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
.config(function ($routeProvider) {
$routeProvider
@telagraphic
telagraphic / directive.js
Created January 21, 2014 17:26
I'm getting a console error: TypeError: Object #<HTMLInputElement> has no method 'hasClass' How can this be? I'm calling it on an html.element?
angular.module('myApp.directives', [])
.directive('checkboxLimit', function() {
return {
restrict: 'A',
link: function(scope, ele, attrs, ctrl) {
scope.$watch('bet.winner', function(newVal, oldVal) {
var bets = angular.element(document.getElementsByClassName('currentBet'));
console.log(newVal);
if (newVal === true) {
angular.forEach(bets, function(bet) {
angular.module('myApp.directives', [])
.directive('checkboxLimit', function() {
return {
restrict: 'A',
replace: true,
link: function(scope, ele, attrs, ctrl) {
console.log(ele);
scope.inputDisabled = false;
scope.$watch('bet.winner', function(newVal, oldVal) {
var bets = angular.element(document.getElementsByClassName('currentBet'));
@telagraphic
telagraphic / controllers.js
Last active January 2, 2016 16:09
Updating a firebase record. Console errors with TypeError: Object #<Object> has no method '$save'
angular.module('myApp.controllers', ['firebase'])
.controller('BettingController', ["$scope", "$firebase", function($scope, $firebase) {
var fireBase = new Firebase("https://flowbetter.firebaseio.com");
$scope.bets = $firebase(fireBase);
$scope.newBet = {
better: "",
startTime: "",
lengthTime: "",
winner: false
@telagraphic
telagraphic / app.js
Created January 4, 2014 21:18
Angular on Fire
var app = angular.module('myApp', [
'ngRoute',
'myApp.services',
'myApp.directives',
'myApp.filters',
'myApp.controllers',
'firebase'
]);
@telagraphic
telagraphic / app.js
Last active January 1, 2016 03:49
angular controller argument is not a function, got undefined
'use strict';
// Declare app level module which depends on filters, and services
angular.module('myApp', [
'ngRoute',
'myApp.filters',
'myApp.services',
'myApp.directives',
'myApp.controllers'
@telagraphic
telagraphic / gist:6524737
Created September 11, 2013 14:51
SCSS Foundation -- js for topbar isn't executing.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Richard Dolan Press</title>