Skip to content

Instantly share code, notes, and snippets.

View caesarsol's full-sized avatar
🍋

cesare soldini caesarsol

🍋
View GitHub Profile
@caesarsol
caesarsol / index.js
Created May 31, 2017 13:52
requirebin sketch
'use strict'
const mobx = require('mobx')
const a = mobx.observable({
b: 1,
c: [],
})
const dom = [
@caesarsol
caesarsol / init.coffee
Last active November 6, 2018 16:18
caesarsol Atom settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
getPrevChar = (editor, chars = 1) ->
pos = editor.getCursorBufferPosition()
posStart = pos.translate([0, -chars])
posEnd = pos
@caesarsol
caesarsol / index.js
Last active May 24, 2017 16:59
regl-camera example
const regl = require('regl')()
const mat4 = require('gl-mat4')
const generateTorus = require('primitive-torus')
const generateCube = require('primitive-cube')
const generatePlane = require('primitive-plane')
const makeCamera = require('regl-camera')
const camera = makeCamera(regl, {
center: [0, 10, 0],
@caesarsol
caesarsol / complex_but_performant.js
Created August 31, 2016 12:31
React collection listener bindings
var collection = [1, 2, 3, 4, 5, 6]
class B extends React.Component {
onLinkClick = (info) => {
alert(info)
}
render() {
return (
<div>
@caesarsol
caesarsol / index.js
Last active April 8, 2016 16:37
BusFactor experiments
//const fetch = require('node-fetch');
const _ = require('lodash');
const moment = require('moment');
const process = require('process');
const d3 = require('d3');
Object.prototype.inspect = function(fn = (x => x)) { console.log(fn(this)); return this; };
const repos = [
'clojure/clojurescript',
@caesarsol
caesarsol / point.js
Last active January 17, 2021 01:26
function loopFrames(func) {
let loopControl = {
_continueFlag: true,
break: function() { this._continueFlag = false },
continued: function() { return (this._continueFlag === true) }
}
requestAnimationFrame(() => {
func(loopControl)
if (loopControl.continued()) loopFrames(func)
{
"always_show_minimap_viewport": false,
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"fold_buttons": true,
"font_face": "Ubuntu Mono",
"font_options":
[
"gray_antialias"
@caesarsol
caesarsol / choices_fields.rb
Created May 15, 2015 09:10
ChoicesFields: model macro to define helper functions on AR model attributes that have pre-determined values
module ChoicesFields
extend ActiveSupport::Concern
module ClassMethods
# Class macro that defines useful function for choice fields (<option> tag fields).
#
# Will define:
# ::fieldname_choices_hash
# Returns the hash given to the `choices_field` macro function.
#