Skip to content

Instantly share code, notes, and snippets.

View bessfernandez's full-sized avatar

bessington bessfernandez

  • seattle, wa
View GitHub Profile
@AdaRoseCannon
AdaRoseCannon / HTMLElementPlus.js
Last active March 3, 2023 11:33
HTML Element Plus for Web Components
'use strict';
class HTMLElementPlus extends HTMLElement {
static defaultAttributeValue() {
/* the name of the attribute is parsed in as a parameter */
return;
}
static parseAttributeValue(name, value) {
# views/fields/belongs_to_scoped/_form.html.erb
<div class="field-unit__label">
<%= f.label field.permitted_attribute %>
</div>
<div class="field-unit__field">
<%= f.select(field.permitted_attribute) do %>
<%= options_for_select(field.associated_resource_options(f.object.send("#{field.name}_candidates")), field.selected_option) %>
<% end %>
</div>
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 28, 2024 23:01
Essential JavaScript Links
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@tkambler
tkambler / hubot_plugin.js
Last active October 7, 2015 10:49
A simple script that demonstrates how you can create a Hubot plugin with raw JavaScript (i.e. without CoffeeScript)
var util = require('util');
/**
* A simple script that demonstrates how you can create a Hubot plugin with raw
* JavaScript (i.e. without CoffeeScript)
*/
var Plugin = function(robot) {
/**
* Instruct Hubot to respond when a message is directed at him, like so:
//
// returns a list of all elements under the cursor
//
function elementsFromPoint(x,y) {
var elements = [], previousPointerEvents = [], current, i, d;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x,y)) && elements.indexOf(current)===-1 && current != null) {
// push the element and its current style
@danielwertheim
danielwertheim / app.js
Last active March 21, 2017 19:30
Super simple SPA foundation thingie.
(function (exports) {
var app = exports.app = {
bindingContext: {
domnode: null,
model: null,
loadTemplate: function (templateName) {
return document.getElementById(templateName).innerHTML;
},
bind: function (templateName, vm) {
this.domnode.innerHTML = this.loadTemplate(templateName);
@nimbupani
nimbupani / cat.js
Created December 5, 2011 00:54 — forked from padolsey/cat.js
Improving Jeremy Keith's CAT news example from http://24ways.org/2011/conditional-loading-for-responsive-designs
var cat = {};
/**
* cat.NewsBox
* Retrieves news from Google
*/
cat.NewsBox = (function(){
function NewsBox(searchTerm, injectFn) {
this.searchTerm = searchTerm;
@cowboy
cowboy / HEY-YOU.md
Last active March 6, 2024 21:36
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.