Skip to content

Instantly share code, notes, and snippets.

@nicerobot
Last active February 10, 2024 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicerobot/4240495 to your computer and use it in GitHub Desktop.
Save nicerobot/4240495 to your computer and use it in GitHub Desktop.
Nice Robot :Gish™

A site served from GitHub Gists, it's a

body {font-family:monospace;}
body > div {
padding: 2em;
margin:.5em;
border-radius: 20px;
-webkit-box-shadow: 0 1px 5px rgba(0,0,0,0.75);
-moz-box-shadow: 0 1px 5px rgba(0,0,0,0.75);
box-shadow: 0 1px 5px rgba(0,0,0,0.75);
}
.created_at {font-size:x-small;;color:#999;}
.updated_at {font-size:xx-small;color:#999;}
#show-source, #hide-source {cursor:pointer;float:right;font-size:xx-small;}
#hide-source {display:none;}
.gist{clear:both;}
<html>
<head>
<title>Nice Robot :Gish</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" href="index.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-resource.min.js"></script>
<script src="//raw.github.com/kares/script.js/master/script.js"></script>
<script>
script.defaults.defer = true;
script.defaults.base = 'http://gist.github.com';
angular.module('gishApp', ['gish']).
config(function($routeProvider) {
$routeProvider.
when('/', {controller:ListCtrl, templateUrl:'list.html'}).
otherwise({redirectTo:'/'});
});
function ListCtrl($scope, Project) {
$scope.projects = Project.query();
}
function SourceCtrl($scope, Project) {
var loaded = false;
$scope.show = function() {
if (!loaded) {
script({ src: "https://gist.github.com/4240495.js", append:"source-ctrl" });
loaded = true;
}
$('.gist').show();
$('#hide-source').show();
$('#show-source').hide();
}
$scope.hide = function(e) {
console.log([e]);
$('.gist').hide();
$('#hide-source').hide();
$('#show-source').show();
}
}
angular.module('gish', ['ngResource']).
factory('Project', function($resource) {
var Project = $resource('https://api.github.com/users/nicerobot/gists');
Project.prototype.update = function(cb) {
return Project.update({id: this._id.$oid},
angular.extend({}, this, {_id:undefined}), cb);
};
Project.prototype.destroy = function(cb) {
return Project.remove({id: this._id.$oid}, cb);
};
return Project;
});
</script>
</head>
<body ng-app="gishApp">
<div>
<h2>Nice Robot :Gish</h2>
<div ng-view></div>
<!-- CACHE FILE: list.html -->
<script type="text/ng-template" id="list.html">
<div class="row-fluid" ng-repeat="project in projects | filter:':Gish' | orderBy:created_at:reverse">
<a class="span7 offset1 description" href="https://blocks.roadtolarissa.com/nicerobot/{{project.id}}/"><i class="icon-off"></i> {{project.description}}</a>
<a class="span2 created_at hidden-phone" href="https://gist.github.com/{{project.id}}/" alt="Gist {{project.id}}"><i class="icon-calendar"></i>{{project.created_at}}</a>
<a class="span2 updated_at hidden-phone" href="https://blocks.roadtolarissa.com/nicerobot/{{project.id}}/" alt="blocks.roadtolarissa.com nicerobot/{{project.id}}"><i class="icon-calendar"></i>{{project.updated_at}}</a>
</div>
</script>
</div>
<div ng-controller="SourceCtrl" id="source-ctrl">
<div id="show-source" ng-click="show()">show source</div>
<div id="hide-source" ng-click="hide()">hide source</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment