Skip to content

Instantly share code, notes, and snippets.

View BinaryMuse's full-sized avatar
🏳️‍🌈
Just gayin' up the place the best I can

Michelle Tilley BinaryMuse

🏳️‍🌈
Just gayin' up the place the best I can
View GitHub Profile
User.methods.setPassword = function(password, callback) {
bcrypt.hash(password, 10, function(err, hash) {
if (err) return callback(err);
this.passwordHash = hash;
callback();
}.bind(this));
};
// To use in, e.g., a controller
user.setPassword(req.body.password, function(err) {
# RealmsController is the only controller in the application, which fetches
# the realm list from the Realms service and displays them in a list.
app.controller 'RealmsController', ($scope, $timeout, $window, Realms, hashChange) ->
$scope.realms = []
$scope.search = ''
$scope.lastUpdate = null
# Any time the URL hash changes, update the `search` variable.
hashChange (value) ->
$scope.search = value
@BinaryMuse
BinaryMuse / README.md
Last active October 18, 2020 13:52
Ractive.js clock example in AngularJS
event = require('pilot/event')
Anchor = require('ace/anchor').Anchor
doc = ace_editor.session.getDocument()
editablePositions = [[1, 0, 2, 0]] # allow editong only the second row
jQuery.each editable, (index, row) ->
editablePositions.push [new Anchor(doc, row[0], row[1]), new Anchor(doc, row[2], row[3])]
Range = require('ace/range').Range
var Parent = require('./parent'),
util = require('util');
var Child = function() {
this.child = 'child';
};
util.inherits(Child, Parent);
Child.prototype.A = function() {
@BinaryMuse
BinaryMuse / robot.js
Created December 18, 2012 22:56
YOUR ROBOT'S NAME
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@BinaryMuse
BinaryMuse / output
Created November 20, 2012 18:37 — forked from anonymous/output
super hack
module Homepage
module V2
class Board
include Redis::Objects
value :name
value :exists
counter :views
@BinaryMuse
BinaryMuse / gist:4029588
Created November 7, 2012 04:38
AngularJS Notes

HTML5 Dev Conf: AngularJS, a Framework for Web Applications (slides)

  • Is jQuery the wrong way to building apps? No. But jQuery doesn't increase the level of abstraction.
  • Building a web app is a lot more than DOM manipulation. It's a necessary condition, but it's not sufficient. What we want to do is take the DOM manipulation portion, and allow you to express it declaratively in HTML.
  • We allow you to turn HTML into a DSL.
  • (view the page source of the slide deck) It turns out this is an Angular app, and look what we get to do. [...] We get to say ``. When we went to create a presentation, we created primitives that are useful for this type of application. [...] The point I'm trying to say is that, while it's tempting to think of AngularJS as a way of building web apps, what it actually is underneath is an HTML compiler. It allows you to come up with a syntax that is best suited
@BinaryMuse
BinaryMuse / app.controllers.js
Created November 4, 2012 09:07
Example of a directive that fetches data via Ajax
angular.module('angular-fb.controllers', [])
.controller('MainController', ['$scope', '$http', function($scope, $http) {
$scope.usernames = [];
$scope.demoUsers = [
"tilley.brandon",
"grockit",
"nodecasts",
"adobe",
"cocacola",
"pepsi"
@BinaryMuse
BinaryMuse / atcs-controls.js
Created September 22, 2012 18:24
atcs-controls.js
var connect = require('connect');
var fs = require('fs');
var querystring = require('querystring');
var util = require('util');
var pageMarkup = 'Error';
var staticFiles = new Array();
try {
staticFiles['/'] = fs.readFileSync('page.html', 'ascii');
staticFiles['/jquery-1.7.1.min.js'] = fs.readFileSync('jquery-1.7.1.min.js', 'ascii');