Skip to content

Instantly share code, notes, and snippets.

View ashnur's full-sized avatar
🐢
fragments of scrolls surround me

Aron Gabor ashnur

🐢
fragments of scrolls surround me
View GitHub Profile
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
@Raynos
Raynos / pure-widget.js
Created December 1, 2014 21:27
Example of pure widget
var createElement = require('virtual-dom/create-element.js');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var document = require('global/document');
/*
A PureWrapperWidget wraps a vnode in a container.
It can do all kinds of DOM specific logic on the
container if you wanted to. Like handling
@toudi
toudi / utils.py
Created November 14, 2014 14:37
recursive model_to_dict
from django.forms.models import model_to_dict as fmodel_to_dict
from django.db.models.related import RelatedObject
def remove_baseattr_name(prefix):
def inner(value):
return value[len(prefix)+1:]
return inner
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@dreispt
dreispt / odoo-api.markdown
Last active December 3, 2019 14:10
Odoo API reference

Fields

from openerp import models, fields, api, _

class MyModel(models.Model):
    _name = 'mymodule.mymodel'
    # Fields are declared as class attributes:
    char = fields.Char('Char', 64)        # name, size
 text = fields.Text('Text')
@lygaret
lygaret / index.js
Last active December 19, 2024 11:26
ES6 Quasi-Literal for JSX
define(function(require) {
var React = require('react');
var paramRegex = /__(\d)+/;
var parser = new DOMParser();
var errorDoc = parser.parseFromString('INVALID', 'text/xml');
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI;
// turns the array of string parts into a DOM
// throws if the result is an invalid XML document.
@raganwald
raganwald / multiple-dispatch.js
Last active August 13, 2019 11:20
Multiple dispatch in JavaScript
function isType (type) {
return function (arg) {
return typeof(arg) === type;
};
}
function instanceOf (clazz) {
return function (arg) {
return arg instanceof clazz;
};
@MidnightLightning
MidnightLightning / package.json
Last active August 29, 2015 14:01
Testing Big Integer performance
{
"name": "mathbuffer-test",
"version": "0.1.0",
"description": "Testing Big Integer implementation performance",
"main": "test.js",
"dependencies": {
"math-buffer": "~0.1.1",
"bigi": "~1.1.0"
},
"author": "Brooks Boyd <[email protected]>"
@bohde
bohde / Main.purs.hs
Created March 15, 2014 23:46
Use websockets with Control.Reactive in Purescript
module Main where
import Control.Monad.Eff
import Control.Reactive
import Debug.Trace
import Prelude
foreign import websocket
"function websocket(url) {\
\ return function(outgoing) {\
@pascalpoitras
pascalpoitras / 1.md
Last active April 10, 2025 14:12
My WeeChat configuration

This configuration is not maintained anymore. You should think twice before using it, Breaking change and security issue will likely eventually happens as any abandonned project.