Skip to content

Instantly share code, notes, and snippets.

@IgorMinar
IgorMinar / angular-bc.js
Created April 2, 2012 22:14 — forked from vojtajina/angular-bc.js
Angular: BC module for scope/controller separation
/**
* @license AngularJS
* (c) 2010-2012 AngularJS http://angularjs.org
* License: MIT
*/
/**
* Backward compatibility module for AngularJS
* @author Vojta Jina <[email protected]>
*
/// bootstrap code
var myApp = angular.module('myApp', []);
//// resource def
var pops;
pops = function($resource) {
return $resource('/pops/:id', {}, {
@IgorMinar
IgorMinar / angular-ctrl-export-proposal.js
Created December 13, 2011 05:44 — forked from vojtajina/angular-ctrl-export-proposal.js
Angular: Export Ctrl Methods Proposal
function($ctrlProvider) {
$ctrlProvider.provide('FooCtrl', FooCtrl);
var export = $ctrlProvider.export;
function FooCtrl($http, $scope) {
this.scope_ = $scope;
this.http_ = $http;
}
FooCtrl.prototype.publicMethodA = export(function(){
<html>
<head>
<script src="http://code.angularjs.org/angular-0.10.3.js" ng:autobind></script>
<script>
function MyCntrl() {
this.list_of_items = ['this', 'that', 'the other'];
this.foo = {choice:'that'};
}
MyCntrl.prototype = {
loadData: function(){
@IgorMinar
IgorMinar / gist:1030586
Created June 16, 2011 23:49 — forked from pmenglund/gist:1028805
Angular
<html>
<head>
<script src="http://code.angularjs.org/angular-0.9.16.min.js" ng:autobind></script>
<script>
function CalculatorController() {
this.integer = /^\d+$/;
this.fraction = /^\d+\.*\d*$/;
this.difficulty = 877226;
this.hashtime = function() { return Math.round(this.difficulty * Math.pow(2, 32) / (this.hashrate * 1000))/(3600*24) };
this.opex = function() { return this.time*24 * this.electricity * this.power / 1000 };
@IgorMinar
IgorMinar / gist:1028816
Created June 16, 2011 07:09 — forked from pmenglund/gist:1028805
Angular
<html>
<head>
<script src="http://code.angularjs.org/angular-0.9.16.min.js" ng:autobind></script>
<script>
var SERVICE_URL = "http://blockexplorer.com/q/getdifficulty";
function FormController($xhr) {
this.posint = /^\d+/;
this.fetch = function() {
var self = this;
$xhr('', SERVICE_URL, function(code, response) {
<!DOCTYPE html>
<html>
<!-- This should be the simplest possible jQuery based CouchApp. Install by uploading to a design document in Futon or putting in _attachments/index.html and running `couchapp push` -->
<head><title>Tiny CouchApp</title></head>
<body ng:init="dbs = couch.allDbs()">
<h1>Tiny CouchApp</h1>
<ul id="databases">
<li ng:repeat="db in dbs"><a href="/_utils/database.html?{{db}}">{{db}}</a></li>
</ul>
</body>