Skip to content

Instantly share code, notes, and snippets.

View deepakkarki's full-sized avatar
🎯
Focusing

Deepak Karki deepakkarki

🎯
Focusing
View GitHub Profile
@deepakkarki
deepakkarki / express-server-side-rendering.md
Created July 3, 2018 10:27 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@deepakkarki
deepakkarki / 0_reuse_code.js
Created December 11, 2016 05:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@deepakkarki
deepakkarki / client.py
Last active August 29, 2015 14:07 — forked from micktwomey/client.py
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()

SET

CMD   A     VALA     B     VALB  
0000 0000 0000 0000 0000 0000 0000 0000
\  / \  / \       / \  / \       / \  / 
SET  DIO      5     VAR      4   ignored
  • A,B are one of DIO, AO, PWM, TMR, user variable, value