Skip to content

Instantly share code, notes, and snippets.

Spencer Carney spencercarnage

View GitHub Profile
View gist:5abc4fd174ee4fb374e8
{
message: "action:timeout",
action_id: "4dafb356-461b-48d5-bd19-49533cb504cc91"
}
View gist:3530adb9f51fc67cab7d
// Connection Map
// https://github.com/Ubiquiti-UI/aircontrol/blob/master/src/scripts/services/models/Topology.js#L188
{
"0974b31a06cb437d93387a3098e8303a": ["bedb1e010b0649ecb9312165ab8dd844", "f9971446bb464b8f9cc47208993c208b", "cpe_0974b31a06cb437d93387a3098e8303a"],
"bedb1e010b0649ecb9312165ab8dd844": ["0974b31a06cb437d93387a3098e8303a", "12130bf43d3d49fbae37b6062c4b08b9", "4f56e442425547ebbe69d200abddaf01", "5226c3d7fff34157819a4486991bd2ab", "96a51d559dd542e18739b2b9910d5a1d", "acd9e4d8a464406895e2a7a34808ddd9", "b2bd748e2c214b8e9f2d034684940641", "ef5154fe27734fc4a2395cad38f16fd4", "f9971446bb464b8f9cc47208993c208b"],
"f9971446bb464b8f9cc47208993c208b": ["0974b31a06cb437d93387a3098e8303a", "bedb1e010b0649ecb9312165ab8dd844"],
"12130bf43d3d49fbae37b6062c4b08b9": ["4f56e442425547ebbe69d200abddaf01", "bedb1e010b0649ecb9312165ab8dd844", "cpe_12130bf43d3d49fbae37b6062c4b08b9"],
"4f56e442425547ebbe69d200abddaf01": ["12130bf43d3d49fbae37b6062c4b08b9", "bedb1e010b0649ecb9312165ab8dd844"],
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<style>
svg {
width: 500px;
height: 500px;
}
View gist:f394e386c7783efabfe9
function checkSlugAvailability(slug) {
if (slug) {
$scope.$apply(function() {
$q.when((new ProfileSlugModel({
id: slug
})).exists(), function(result) {
if (result) {
isSlugAvailable = false;
} else {
isSlugAvailable = true;
@spencercarnage
spencercarnage / andReturn vs andCallFake
Last active Aug 29, 2015
Jasmine's `andReturn` vs `andCallFake`
View andReturn vs andCallFake
// Jasmine's `andReturn` sets the value at instantiation and it can
// never be changed after that apparently. Use `andCallFake` instead
// if you need it to be dynamic.
var value = 9;
var getValueOne = jasmine.createSpy('spyOneAndReturn').andReturn(value);
var getValueTwo = jasmine.createSpy('spyOneCallFake').andCallFake(function () {
View Angular Directory Structure
// Example pulled from https://scotch.io/tutorials/angularjs-best-practices-directory-structure
/*
app/
----- shared/ // acts as reusable components or partials of our site
---------- sidebar/
--------------- sidebarDirective.js
--------------- sidebarView.html
---------- article/
--------------- articleDirective.js
View gist:d804d81ff635a2115b37
{
"MAP": {
"MAP_HEADER": "Some string",
"MAP_DESCRIPTION": "A description"
},
"DEVICES": {
"DEVICES_HEADER": "My devices"
}
}
@spencercarnage
spencercarnage / New Directory Structure
Created Apr 7, 2015
refactoring the atlas component to use a better directory structure
View New Directory Structure
component/
├── atlas.module.js
├── atlas.provider.js
├── atlas.provider_spec.js
├── circle.directive_spec.js
├── circle.directive.spec.js
├── connection
├── connection.directive.js
├── connection.directive_spec.js
├── connection.controller.js
@spencercarnage
spencercarnage / gist:b16100b536f6df0262ac
Created Apr 15, 2015
Babelify transform with runtime
View gist:b16100b536f6df0262ac
"browserify": {
"transform": [
[
"babelify",
{
"optional": [
"runtime"
],
"whitelist": [
"es6.arrowFunctions",
View application.js
$(window).load(function(){
if (!Modernizr.input.placeholder){
$('input').supportPlaceHolder();
}
if (!Modernizr.textarea.placeholder){
$('textarea').supportPlaceHolder();
}
});
You can’t perform that action at this time.