Skip to content

Instantly share code, notes, and snippets.

View amatiasq's full-sized avatar

A. Matías Quezada amatiasq

View GitHub Profile
@amatiasq
amatiasq / constructor-extend.js
Last active February 15, 2021 22:18
A simple constructor extension function. Creates a constructor who prototypes "this" and adds the properties passed.
/*globals define, module */
//jshint camelcase: false, curly:false
(function(root) {
'use strict';
// __proto__ will be used if supported
//jshint -W103
function prototype_PROTO(parent, child, methods) {
@amatiasq
amatiasq / tpl.js
Last active February 15, 2021 22:18
A simple RequireJS plugin to include Handlebars templates
define(function(require) {
var text = require('text');
var view = require('view');
var cache = {};
function load(name, parentRequire, done, config) {
text.load(name, parentRequire, function(template) {
cache[name] = template;
@amatiasq
amatiasq / Handlebars- Backbone.js
Created February 5, 2013 00:06
This allow Handlebars to look up Backbone Model's attributes: {{ user.address.street }} If user is a Backbone Model this will become user.get("address").street And if user.get("adress") is also a Backbone Model this will be produced: user.get("address").get("street")
Handlebars.JavaScriptCompiler.prototype.nameLookup = function(parent, name, type) {
var result = '(' + parent + ' instanceof Backbone.Model ? ' + parent + '.get("' + name + '") : ' + parent;
if (/^[0-9]+$/.test(name)) {
return result + "[" + name + "])";
} else if (Handlebars.JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return result + "." + name + ')';
} else {
return result + "['" + name + "'])";
}
};
@amatiasq
amatiasq / Preferences.sublime-settings
Created November 16, 2012 15:08
My Sublime Text configuration
{
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"rulers": [ 80, 120 ],
"highlight_line": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"auto_complete_commit_on_tab": true,
"shift_tab_unindent": true,
interface Message<Type extends string | number, Data = never> {
type: Type;
data: Data;
}
type MessageData<
Msg extends Message<any, any>,
Type extends Msg['type']
> = Extract<Msg, { type: Type }>['data'];
let cache = null;
export function myCachedRequest() {
if (cache) {
return Promise.resolve(cache);
}
return fetch('potato.com/foo').then(x => {
cache = x;
return x
  • 0:00 Event Presentation
  • 2:03 Presenter Introduces Uncle Bob
  • 3:41 Uncle Bob Introduction / My Tribe
  • 4:49 How Far is the Sun?
  • 10:52 Introduction to Clean Code
  • 12:21 The current Society works with Software
  • 19:47 Volkswagen case / Introduction to the Ethics of Software Development
  • 24:28 Why are Programmers so slow?
  • 32:13 What is a Clean Code?
let url = '';
a
.split('\n')
.map(x => {
if (!x) {
return x;
}
if (x.startsWith('- [Lesson ')) {
@amatiasq
amatiasq / softwarecraftsmanship.json
Created August 21, 2020 15:41
Signers of Software Craftmanshift Manifesto (so far)
This file has been truncated, but you can view the full file.
[
{
"name": "Doug Bradbury",
"location": "Chicago, IL, USA"
},
{
"name": "Corey Haines",
"location": "Cleveland, OH"
},
{
#!/bin/bash
# Clone repo
sudo apt install git
git clone https://github.com/ayulockin/3d-photo-inpainting.git
# Install python 3.7
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa