Skip to content

Instantly share code, notes, and snippets.

@lassombra
lassombra / .babelrc
Last active February 21, 2017 16:08
To Decorate or not to Decorate
{
"presets": [
"latest"
],
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
]
}
function get(url) {
return new Promise((resolve, reject) => {
$.get(url, {success: resolve, error: reject})
});
}
@lassombra
lassombra / schema.graphqls
Created August 17, 2017 15:08
The schema related to getting a file
type File {
id: Int!
name: String!
size: Int
type: String!
md5: String!
uploadedBy: String!
uploaded: Date!
filePath: String!
dpi: Int!
@lassombra
lassombra / resolvers.js
Created August 17, 2017 15:14
resolvers for file example
{
Query: {
file({id}) {
// connector is a dataload aware connector which has been instantiated
// with information about this domain specifically
return connector.get(id, context);
}
},
File: {
// definite candidate for memoization
@lassombra
lassombra / jqueryReactWrapper.jsx
Last active November 10, 2017 16:25
jquery react wrapper
import React from 'react';
export default class Wrapper extends React.Component {
shouldComponentUpdate() {
// very important. You never rerender, instead use component did receive props and update your jquery plugin
return false;
}
safeRender() {
return <div className="some-class-that-matters" ref={element => this.wrapper = element}></div>;
componentDidMount() {
@lassombra
lassombra / 30_days_in_space_day_5.ino
Created March 21, 2023 04:00
Requires the circuit layout from day 4.
#include <Arduino.h>
#include <TimerOne.h>
#include <util/atomic.h>
#define LED1 10 // RED
#define LED2 11 // BLUE
#define LED3 12 // GREEN
#define SWITCH_1 2
#define SWITCH_2 3
#define SWITCH_3 4
@lassombra
lassombra / day10.ino
Created April 1, 2023 06:40
Synchronizing arduino to Razer Chroma
#include <Arduino.h>
#define R 11
#define G 10
#define B 9
String read;
String getMessage() {
return Serial.readStringUntil('|');