Skip to content

Instantly share code, notes, and snippets.

@cachafla
cachafla / javascript_resources.md
Last active August 25, 2015 23:53 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@cachafla
cachafla / css_resources.md
Last active August 26, 2015 01:08 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

ES Concepts

Database:      [DATABASE] -> [TABLE] -> [ROW]
Elasticsearch: [INDEX]    -> [TYPE]  -> [DOCUMENT]

A node is a running instance of Elasticsearch, while a cluster consists of one or more nodes with the same cluster.name that are working together to share their data and workload. As nodes are added to or removed from the cluster, the cluster reorganizes itself to spread the data evenly.

def hi
puts "hi
end
# La idea es que cada cuenta tiene un numero, por ej 5. Pero su padre tiene numero 2 y el padre de este tiene numero 1.
# Entonces quiero generar el numero en forma: "1.2.5. Cuenta XXX"
# Lo que hago es ir subiendo en la recursion hasta llegar a la raiz que es parent.nil?
def numero_total
if parent.nil?
return"#{numero}."
else
return "" + parent.numero_total
end
end
<h2 id="titulo_2" align="center">Cifras en pesos</h2>
<p style="color: green"><%= flash[:notice] %></p>
<p><%= link_to "Volver a menú principal", :controller => "presupuestos" %></p>
<% form_tag({:action => "update"}, :id => "presupuesto", :onkeypress => "return event.keyCode!=13;") do %>
<p><%= submit_tag "Guardar", :id => "submit", :disabled => true %></p>
<h2>Editando centro de costo: <%= "#{@cc.codigo} - #{@cc.nombre}"%></h2>
<h3>Estado del centro de costo: <span id ="label_completo" class="doc_incompleto">Incompleto</span></h3>
<div id="tabla">
<div style="width:2500px">
<table width="2500">
# Begin: code to initialize just one time
Nanite.identity = Nanite.gensym
AMQP.start :host => 'localhost', :user => 'mapper', :pass => 'testing',
:vhost => '/nanite'
Nanite.mapper = Nanite::Mapper.new(15)
# End code
EM.add_timer(16) do
Nanite.request("/mock/list", '', :target => 'barney') do |res|
p res
f1 = Factura.first
# Quiero saber todos los productos que se han comprado
ps = f1.productos
p1 = Producto.first
# Quiero saber en que facturas aparece este producto
fs = p1.facturas
# Quiero saber que producto se ha vendido 3 veces y a que factura pertenece
r1 = Relacion.first(:cantidad => 3)
def format_consecutivo(num)
cero = "0"
times = 4 - num.to_s.size
return cero*times + num.to_s
end
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 57005)
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py", line 1062, in process_request_in_thread
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 522, in __init__
self.handle()
File "/Library/Python/2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py", line 436, in handle