Skip to content

Instantly share code, notes, and snippets.

View bgando's full-sized avatar

Bianca bgando

View GitHub Profile
.aspect-ratio{height:0!important;position:relative!important}.aspect-ratio-16x9{padding-bottom:56.25%!important}.aspect-ratio-10x13{padding-bottom:130%!important}.aspect-ratio-8x5{padding-bottom:62.5%!important}.aspect-ratio-7x3{padding-bottom:42.86%!important}.aspect-ratio-1x1{padding-bottom:100%!important}.aspect-ratio-object{position:absolute!important;top:0!important;right:0!important;bottom:0!important;left:0!important;width:100%!important;height:100%!important}.bg-center{background-position:50%!important}.bg-center,.bg-top{background-repeat:no-repeat!important}.bg-top{background-position:top!important}.bg-right{background-position:100%!important}.bg-bottom,.bg-right{background-repeat:no-repeat!important}.bg-bottom{background-position:bottom!important}.bg-left{background-repeat:no-repeat!important;background-position:0!important}.cover{background-size:cover!important}.contain{background-size:contain!important}.ba{border-style:solid!important;border-width:1px!important}.bt{border-top-style:solid!important
@bgando
bgando / removeCanProxy.js
Last active February 9, 2022 11:58
Codemod to transform can.proxy(fn, context); -> fn.bind(context);
export default function(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
const matchesCanProxy = exp => {
return exp.type === 'CallExpression' && (exp.callee.object.name === 'can' || exp.object.name === 'can') && (exp.callee.property.name === 'proxy' || exp.property.name === 'proxy')
}
const removeCanProxy = p => {
@bgando
bgando / can-view-model-codemod.js
Last active December 13, 2017 22:28
Codemod to convert x.viewModel() to canViewModel(x) and add var canViewModel = require('can-view-model');
export default function(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
const removeViewModel = p => {
if (p.node.expression.type === 'CallExpression' && p.node.expression.callee.property && p.node.expression.callee.property.name === 'viewModel') {
p.node.expression = p.node.expression.callee.object;
var ast = j.callExpression(j.identifier('canViewModel'), [p.node.expression]);
p.node.expression = ast;
@bgando
bgando / gist:8a0bedeb738667b979c2f714515f0665
Created November 1, 2017 06:47
detect if an element is causing horizontal scroll
docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
var simpleObservable = function(value){
var handlers = new KeyTree([Object, Object, Array]);
var obs = {
get: function(){
Observation.add(this, "value");
return this.value;
},
set: function(value){
var old = this.value;
this.value = value;
function replaceVersion(deps) {
if(deps["can-stache-key"]) {
deps["can-stache-key"] = "^0.1.0"
}
return deps;
}
module.exports = function transformer(file, api) {
var src = file.source;
0 info it worked if it ends with ok
1 verbose cli [ '/Users/bianca/.nvm/versions/node/v7.7.1/bin/node',
1 verbose cli '/Users/bianca/.nvm/versions/node/v7.7.1/bin/npm',
1 verbose cli 'uninstall',
1 verbose cli '-g',
1 verbose cli 'donejs' ]
2 info using npm@5.0.3
3 info using node@v7.7.1
4 verbose npm-session 8cd5ad4bab852f40
5 silly install loadCurrentTree
@bgando
bgando / hubspot-blog.md
Created July 17, 2017 19:27
steps to publish a blog on hubspot with minimal formatting issues

Hubspot

  1. Write your post in Markdown (probably on Google Docs)
  2. Open the markdown editor at http://dillinger.io/
  3. Write (or paste) {% raw %} {% endraw %} in the blank editor - this is the most annoying unavoidable step, but only needed if you have {{ }} tags in the article
  4. Paste your markdown in between the raw/endraw tags
  5. Export as -> Styled HTML
  6. Open the downloaded file, copy the body
  7. Open your Hubspot post, go to Tools > Source Code
  8. Paste
{"date":"2017-02-24 03:07:45","user":"21109850","fuel":"37","ammo":"2","steel":"13","baux":"5","seaweed":"0","type":"LOOT","product":"134"}
{"date":"2017-02-22 04:40:13","user":"21109850","fuel":"37","ammo":"2","steel":"13","baux":"5","seaweed":"0","type":"LOOT","product":"75"}
{"date":"2017-02-21 20:47:51","user":"26464462","fuel":"37","ammo":"3","steel":"19","baux":"5","seaweed":"1","type":"LOOT","product":"81"}
{"date":"2017-02-21 16:53:16","user":"19572827","fuel":"5","ammo":"4","steel":"15","baux":"5","seaweed":"2","type":"LOOT","product":"22"}
{"date":"2017-02-21 16:48:26","user":"19572827","fuel":"5","ammo":"4","steel":"15","baux":"5","seaweed":"2","type":"LOOT","product":"14"}
{"date":"2017-02-21 16:42:28","user":"19572827","fuel":"5","ammo":"4","steel":"15","baux":"5","seaweed":"2","type":"LOOT","product":"65"}
{"date":"2017-02-20 23:56:43","user":"26464462","fuel":"37","ammo":"3","steel":"19","baux":"5","seaweed":"1","type":"LOOT","product":"71"}
{"date":"2017-02-20 23:43:24","user":"26464462","fuel
var Appointment = Backbone.Model.extend({});
var appointment = new Appointment();
appointment.set('title', 'My knee hurts');
var AppointmentView = Backbone.View.extend({
tagName: 'ul',
render: function(){
$(this.el).html('<li>' + this.model.get('title') + '</li>');
}
});
var appointmentView = new AppointmentView({model: appointment});