Skip to content

Instantly share code, notes, and snippets.

View aredridel's full-sized avatar
💭
See my social media for status.

Aria Stewart aredridel

💭
See my social media for status.
View GitHub Profile
@aredridel
aredridel / gist:5427526
Created April 20, 2013 21:36
conversation on dependencies
17:17 judofyr: hey folks
17:17 judofyr: what's up?
17:17 Aria: Not too much.
17:17 Aria: Grumbling about managing ruby dependencies with RPM.
17:17 judofyr: RPM?
17:18 Aria: It's become so damn hard. So much versioning hell out there.
17:18 judofyr: why would you do that?
17:18 judofyr: bundler it up
17:18 Aria: I'm the OS integrator. We're trying to package apps out there for installation.
17:19 judofyr: hm
@aredridel
aredridel / demo.js
Last active December 16, 2015 18:58
Tiny backbone.js hints
var RowView = Backbone.View.extend({
initialize: function () {
this.model.on('change', this.handleChange, this);
},
handleChange: function () {
this.model.save();
},
render: function () {
this.setElement($('<tr>'));
this.$el.append("<td>" + this.model.get('id') + "</td><td>" + this.model.get('field1') + "</td>");
/usr/img/lib/imgadm.js:1124
for (var j = 0; j < imageSet.length; j++) {
^
TypeError: Cannot read property 'length' of undefined
at done (/usr/img/lib/imgadm.js:1124:45)
at async.forEach (/usr/img/node_modules/async/lib/async.js:88:21)
at IMGADM.sourcesList.async.forEach.err (/usr/img/lib/imgadm.js:1102:21)
at IMGADM.clientFromSource (/usr/img/lib/imgadm.js:744:13)
at Source.getResolvedUrl (/usr/img/lib/imgadm.js:361:13)
at /usr/img/lib/imgadm.js:98:13
module ApplicationHelper
def combine_highlight(selected_text, surrounding_text)
if surrounding_text.include? selected_text
split_text_array = surrounding_text.split(selected_text)
if split_text_array[0].blank?
if split_text_array[1].blank?
content_tag(:p, content_tag(:span, selected_text, class:"selected"))
else
module ApplicationHelper
def combine_highlight(selected_text, surrounding_text)
if surrounding_text.include? selected_text
split_text = surrounding_text.split(selected_text)
content_tag(:p, (split_text[0] || '').html_safe + content_tag(:span, selected_text, class:"selected") + (split_text[1] || '').html_safe)
else
content_tag(:p, surrounding_text, class:"selected")
end
end
Friend.findOne({
userId: req.signedCookies.userid
}, function (err, signedInUser) {
function doCheck(err, currentUser) {
if (err) {
res.send(err);
} else {
console.log('doCheck');
//for(var x = 0; x < users.length; x++) {
//var currentUser = users[x];
@aredridel
aredridel / Filesystem.md
Last active December 31, 2015 00:09
Minimal filesystem-like API

Minimal Filesystem-like API

No sync versions of functions. These may encapsulate high-latency remote filesystems. Including sync operations is inappropriate.

fs.rename

fs.stat

@aredridel
aredridel / client.html
Last active January 1, 2016 17:29 — forked from raulp/server.js
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
<script>
var news = io.connect('http://localhost:3000/').of('/news');
news.emit("raul", new Array("1","2","3","4","5","6","7","8","9","10") );
news.on('get_random_number_from_raul', function(data) {
console.log('random', data);
});
@aredridel
aredridel / private.js
Created January 8, 2014 02:48
A method for having a 'private method' in javascript.
module.exports = function Class() {}
Class.prototype.method = function () {
SomethingInternal.call(this)
}
function SomethingInternal() {
console.log("I'm internal, and I'm currently a method of", this);
}
var fs = require('fs');
function writeTime(){
var lifedata;
var filename = './life.json';
fs.readFile(filename, 'utf8', function (err, data) {
if (err) throw err;
lifedata = JSON.parse(data);
doWrite();
});