Skip to content

Instantly share code, notes, and snippets.

Handlebars is a semantic web template system, started by Yehuda Katz in 2010.
Handlebars.js is a superset of Mustache, and can render Mustache templates in addition to Handlebars templates.
More: http://handlebarsjs.com/
1. Expressions.
1.1 Basic usage.
@aponxi
aponxi / git-deployment.md
Created July 12, 2018 20:18 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

@aponxi
aponxi / promise_while_loop.js
Created June 17, 2018 02:58 — forked from victorquinn/promise_while_loop.js
Promise "loop" using the Bluebird library
var Promise = require('bluebird');
var promiseWhile = function(condition, action) {
var resolver = Promise.defer();
var loop = function() {
if (!condition()) return resolver.resolve();
return Promise.cast(action())
.then(loop)
.catch(resolver.reject);
@aponxi
aponxi / Git push deployment in 7 easy steps.md
Created May 1, 2018 01:50 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@aponxi
aponxi / gist:e4bd27293dafe88e3e506b43e3309997
Created January 10, 2018 19:54 — forked from cblanc/gist:46ebbba6f42f61e60666
First 1000 Prime Numbers (CSV)
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1

HOW TO CREATE A SIMPLE JAVASCRIPT LIBRARY IN JQUERY STYLE

https://bjarneo.codes/how-to-create-a-simple-javascript-library-like-jquery/

In this blog post I’ll show you a simple approach to create a JavaScript library that uses the same syntax as jQuery called method chaining. Lets call our library Q.

Example of how we could use Q: Q(‘.class’).hide();

Why?

You may think “why the heck would I need to create my own library when we got jQuery”, and the answer is simple. YOU DO NOT NEED TO USE JQUERY FOR EVERYTHING. If you’re eager to learn how JavaScript actually work, and/or you’re creating a small application, use your own code and test it in different browsers / browser versions.

@aponxi
aponxi / some.router.js
Last active April 26, 2017 16:57
Node JS Express Cookie Snippet
//use npm install cookie-parser --save
//put the following snippet inside a route like: router.post('/save', function (req, res, next) {
//set cookie
var cookie = req.cookies['profile_id'];
if (cookie === undefined) {
try {
res.cookie('profile_id', profile_id, {
path : '/survey',
expires : new Date(Date.now() + 900000),
httpOnly : false
@aponxi
aponxi / neo4j_cypher_cheatsheet.md
Created April 24, 2017 15:25 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
@aponxi
aponxi / chrome.bookmark.parser.js
Created March 26, 2017 00:07
Chrome Bookmark Parser
function parse(callback) {
results = new Array();
anchors = $("dl").find("a");
anchors.each(function(i, e) {
var add_date, name, result, tags, url;
url = $(e).attr("href");
name = $(e).text();
add_date = $(e).attr("add_date");
tags = new Array();
$(e).parents("dl").each(function(ii, ee) {
// Because we want to access DOM node,
// we initialize our script at page load.
window.addEventListener('load', function () {
// This variables will be used to store the form data
var text = document.getElementById("i1");;
var file = {
dom : document.getElementById("i2"),
binary : null
};