Skip to content

Instantly share code, notes, and snippets.

View bmxpert1's full-sized avatar

Kevin Bouwkamp bmxpert1

View GitHub Profile
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@xtranophilist
xtranophilist / ko_selectize.js
Last active February 9, 2019 06:42
ko_selectize.js ; Full details and demo here - http://motorscript.com/selectize-js-binding-knockout-js/
var inject_binding = function (allBindings, key, value) {
//https://github.com/knockout/knockout/pull/932#issuecomment-26547528
return {
has: function (bindingKey) {
return (bindingKey == key) || allBindings.has(bindingKey);
},
get: function (bindingKey) {
var binding = allBindings.get(bindingKey);
if (bindingKey == key) {
binding = binding ? [].concat(binding, value) : value;
@DanKnox
DanKnox / websocket-rails_message_format.js
Last active February 10, 2016 14:00
Format of WebsocketRails Messages
/****** Current Format ******/
// Basic Message
metadata = {
id: 1234234234, // Randomly generated by the client. Used for receiving success/fail callbacks
client_id: 123456 // Sent from the server with the `websocket_rails.client_connected` event which is sent after the connection is opened. Store this and send it with each message.
data: {name: 'shoes'} // Arbitrary data. Can be Object or String. This is available through #message or #data in the controller.
}
event = ["products.new", metadata]
@ubermajestix
ubermajestix / inspector.rb
Created September 5, 2012 20:35
Override inspect on ruby objects
# When an RSpec test like this fails,
#
# @my_array.should == [@some_model, @some_model2]
#
# RSpec will call inspect on each of the objects to "help" you figure out
# what went wrong. Well, inspect will usually dump a TON OF SHIT and make trying
# to figure out why `@my_array` is not made up of `@some_model` and `@some_model2`.
#
# This little module and technique helps get around that. It will redefine `inspect`
# if you include it in your model object.