Skip to content

Instantly share code, notes, and snippets.

Avatar
🦇
lead dev @ Accurat

cesare soldini caesarsol

🦇
lead dev @ Accurat
View GitHub Profile
@caesarsol
caesarsol / index.js
Created May 31, 2017
requirebin sketch
View index.js
'use strict'
const mobx = require('mobx')
const a = mobx.observable({
b: 1,
c: [],
})
const dom = [
@caesarsol
caesarsol / init.coffee
Last active Nov 6, 2018
caesarsol Atom settings
View init.coffee
# 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
regl-camera example
View index.js
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 Aug 31, 2016
React collection listener bindings
View complex_but_performant.js
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 Apr 8, 2016
BusFactor experiments
View index.js
//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',
View point.js
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)
View Preferences.sublime-settings
{
"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
ChoicesFields: model macro to define helper functions on AR model attributes that have pre-determined values
View choices_fields.rb
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.
#