Skip to content

Instantly share code, notes, and snippets.

View joseluisq's full-sized avatar

Jose Quintana joseluisq

View GitHub Profile
// for demo: http://jsbin.com/jeqesisa/7/edit
// for detailed comments, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " this.name == 'Sam' && this.age === '12' " }}
@joseluisq
joseluisq / 0readme.md
Last active July 19, 2022 20:20 — forked from plentz/nginx.conf
Best Nginx Configuration For Security

Best Nginx Configuration For Security

To generate your dhparam.pem file, run in the terminal

$ openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

SSL upgrades on rubygems.org and RubyInstaller versions

Hello,

If you reached this page, means you've hit this SSL error when trying to pull updates from RubyGems:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

This error is produced by changes in rubygems.org infrastructure, please

@joseluisq
joseluisq / node-rm-rf-async.js
Last active September 18, 2017 17:56 — forked from geedew/node-rm-rf-async.js
NodeJS: Remove async directory that is not empty
// http://www.geedew.com/remove-a-directory-that-is-not-empty-in-nodejs/
var fs = require('fs');
var rmdirAsync = function(path, callback) {
fs.readdir(path, function(err, files) {
if (err) {
// Pass the error on to callback
callback(err, []);
return;
require(['app'], function (App) {
App.init();
});
//app.js
define([
'pages'
], function (pages) {
return {
init : function () {
@joseluisq
joseluisq / index.html
Last active August 29, 2015 14:24 — forked from pmanijak/index.html
<!doctype html>
<html ng-app="project">
<head>
<title>Angular: Service example</title>
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<script>
var projectModule = angular.module('project',[]);
projectModule.factory('theService', function() {
return {
@joseluisq
joseluisq / .eslintrc
Last active August 29, 2015 14:26 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@joseluisq
joseluisq / .eslintrc
Last active June 22, 2016 07:10 — forked from ghostwords/.eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"arrowFunctions": false, // enable arrow functions
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"classes": false, // enable classes
"defaultParams": false, // enable default function parameters
"destructuring": false, // enable destructuring
@joseluisq
joseluisq / node_ssh2_transfer_dir.js
Last active October 11, 2015 00:53 — forked from mscdex/gist:c1a7199af2af9d3ceb1c
Transfer a directory over SSH with Node SSH2
var tar = require('tar-fs');
var zlib = require('zlib');
function transferDir(conn, remotePath, localPath, compression, cb) {
var cmd = 'tar cf - "' + remotePath + '" 2>/dev/null';
if (typeof compression === 'function')
cb = compression;
else if (compression === true)
compression = 6;
@joseluisq
joseluisq / gulpfile.js
Created November 3, 2015 07:17 — forked from cgmartin/gulpfile.js
Node ES6 istanbul, isparta, mocha-co gulpfile example
'use strict';
var gulp = require('gulp');
var del = require('del');
var mocha = require('gulp-mocha-co');
var istanbul = require('gulp-istanbul');
var isparta = require('isparta');
var coverageEnforcer = require('gulp-istanbul-enforcer');
var paths = {
server: {