Skip to content

Instantly share code, notes, and snippets.

@git-toni
git-toni / builder-templates.js
Created January 19, 2017 14:37
EJS templates + partials
try {
var ejs = require('ejs');
var fs = require('fs');
var data = [
{filename:'one', data:{ number:2,str:'tool' }},
{filename:'two', data:{}},
{filename:'three', data:{}},
]
var tfname = __dirname + '/template.ejs'
{
"NOGUEEEEEEEEy":"byeeee",
"numero": 445345345
}
{"success"=>true,
"terms"=>"https://currencylayer.com/terms",
"privacy"=>"https://currencylayer.com/privacy",
"timestamp"=>1483803068,
"source"=>"USD",
"quotes"=>
{"USDAED"=>3.672804,
"USDAFN"=>66.730003,
"USDALL"=>128.399994,
"USDAMD"=>483.440002,
@git-toni
git-toni / cyclic.js
Created November 22, 2016 11:20
mobx cyclic error
//StoreA.js
import importedB from './StoreB'
class StoreA{
@observable fieldA
@computed get computedA(){
return `I'm a ${this.fieldA} derived from ${importedB.computedB}`
}
}
@git-toni
git-toni / index.js
Last active November 19, 2016 17:04
Mobx-React Provider test
import React,{Component} from 'react'
import ReactDOM from 'react-dom'
import {observable} from 'mobx'
import {observer, Provider} from 'mobx-react';
const store=observable({
num:33,
name:'john'
})
import * as edit from 'react-edit';
class MyTable extends React.Component{
constructor(props){
super(props)
this.state={
editedCell:null,
rows:[],
columns:[],
title: props.title
@git-toni
git-toni / mock.js
Created March 25, 2016 20:50
Testing a mithril.js module
mock = (function () {
"use strict"
var window = {}
window.window = window
var document = window.document = {
// FIXME: add document.createRange().createContextualFragment()
@git-toni
git-toni / MyTest.js
Last active March 25, 2016 18:35
Testing Mithriljs module
;(function(){
var test = require('tape');
//global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var m = require('mithril');
var Module = require('../module.js');
var config={
url:'/urltoken',
title:'Hello there'
}
@git-toni
git-toni / app.js
Created April 20, 2015 17:04
Brunch + Riot troubles
(function() {
'use strict';
var globals = typeof window === 'undefined' ? global : window;
if (typeof globals.require === 'function') return;
var modules = {};
var cache = {};
var has = ({}).hasOwnProperty;
@git-toni
git-toni / rainforest.rb
Created November 15, 2014 19:52
Rainforest challenge
#!/bin/env
require 'httparty'
require 'cgi'
require 'pry'
myid=995287801
200.times do |i|
begin
response=HTTParty.get("http://letsrevolutionizetesting.com/challenge.json?id=#{myid}")