Skip to content

Instantly share code, notes, and snippets.

View mxriverlynn's full-sized avatar
🏳️‍🌈
coding while trans

River Lynn Bailey mxriverlynn

🏳️‍🌈
coding while trans
View GitHub Profile
@mxriverlynn
mxriverlynn / browser_code.js
Created May 1, 2012 22:02
client side socket.io code to listen to all events
var socket = io.connect("http://myserver");
socket.on("*", function(){
// listen to any and all events that are emitted from the
// socket.io back-end server, and handle them here.
// is this possible? how can i do this?
});
@mxriverlynn
mxriverlynn / generate html from haml.rb
Created December 17, 2010 18:18
Verifying generated html with HAML, Cucubmer, Capybara and RSpec
haml_file = "path/to/my/filename.haml"
haml_data = File.read(haml_file)
result = Haml::Engine.new(haml_data).render
@mxriverlynn
mxriverlynn / 1-form.html
Created June 15, 2011 18:14
binding a button enable/disable to a backbone model
<form action="/login" id="login-form">
Username: <input type="text" id="username"><br>
Password: <input type="password" id="password"><br>
<button id="login" disabled="true">Login</button>
</form>
@mxriverlynn
mxriverlynn / compose.js
Created January 23, 2012 03:04
functional js calculator
var one = value(1);
var two = value(2);
var three = value(3);
var four = value(4);
// (1 + 2) * 3 - 4 == 5
var added = add(one, two)
var multiplied = multiply(added, three)
var resultFunc = subtract(multiplied, four);
@mxriverlynn
mxriverlynn / 1-has_image.rb
Created September 27, 2011 21:30
capybara has_image? matcher
module Capybara
class Session
def has_image?(src)
has_xpath?("//img[contains(@src,\"/images/#{src}\")]")
end
end
end
@mxriverlynn
mxriverlynn / 1.js
Created January 2, 2012 20:01
reducing router code
MyRouter = Backbone.Router.extend({
routes: {
"": "mail",
"inbox": "mail",
"inbox/categories/:category": "mailCategory",
"inbox/:id": "mailMessage"
},
mail: function(){
BBCloneMail.MailApp.show();
@mxriverlynn
mxriverlynn / 1-ModelWithChangedEvents.js
Created June 15, 2011 03:12
simple backbone.js examples
var SomeModel = Backbone.Model.extend({});
someModel = new SomeModel();
someModel.bind("change", function(model, collection){
alert("You set some_attribute to " + model.get('some_attribute'));
});
someModel.set({some_attribute: "some value"});
@mxriverlynn
mxriverlynn / gitup.sh
Last active July 20, 2020 20:08
A small script to automate the "git update dance" for Rails projects
function gitup {
# set defaults for all options
GITUP_MERGE_COMMAND=rebase
GITUP_BRANCH_NAME=development
GITUP_REMOTE_NAME=origin
GITUP_SKIP_UPDATE=0
GITUP_SKIP_MIGRATIONS=0
# load user level settings as overrides
local user_config_file="$(echo ~/.gituprc)"
@mxriverlynn
mxriverlynn / .gituprc
Last active July 20, 2020 14:20
gitup's configuration
# Gitup: Git Update Dance Configuration
# -------------------------------------
# configuration for gitup can be set as a default for the current user
# by adding a ~/.gituprc file with settings
#
# current project or local directory settings can be added in ./.gituprc
#
# the .gituprc file is a valid shell script, loaded every time gitup is
# run. this means you can add logic, functions, and other calls to the
# .gituprc file and it will be executed at runtime
@mxriverlynn
mxriverlynn / 1_example.js
Last active April 16, 2020 05:12
node-oracledb cursor handling
// set up your oracle stuff ...
function runIt(cb){
// connection and other setup here
var bindvars = {
o_cursor: {
type: oracledb.CURSOR,