Skip to content

Instantly share code, notes, and snippets.

View alexjpaz's full-sized avatar
🌮

Alexander Paz alexjpaz

🌮
View GitHub Profile
@rakannimer
rakannimer / add-jest-to-nwb.sh
Last active April 14, 2019 02:29
Adding jest tests to nwb project
yarn add -D jest babel-jest babel-preset-es2015 babel-preset-react react-test-renderer
#Edit package.json adding the jest command :
"scripts": {
"build": "nwb build-react-component",
"clean": "nwb clean-module && npm clean-demo",
"start": "nwb serve-react-demo",
"test": "nwb test",
"test:coverage": "nwb test --coverage",
"test:watch": "nwb test --server",
"test:jest": "jest"
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path("$"))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
@capaj
capaj / app-config.js
Created May 27, 2015 09:07
useful config for your angular apps
app.config(function($compileProvider) {
if (!location.host.match(/localhost/)) {
$compileProvider.debugInfoEnabled(false);
}
})
Vagrant::Config.run do |config|
config.vm.box = "centos-63-x64"
config.vm.share_folder "PuppetFiles", "/etc/puppet/files", "./files"
config.vm.define :redis_server do |redis_server|
redis_server.vm.network :hostonly, "192.168.0.10"
redis_server.vm.provision :puppet do |puppet|
puppet.manifest_file = "redis_server_manifest.pp"
puppet.options = ["--fileserverconfig=/vagrant/fileserver.conf"]
@kdonald
kdonald / JsonNodeRowMapper.java
Created March 20, 2012 16:35
Auto Mapping a JDBC ResultSet to JSON
// convenient Spring JDBC RowMapper for when you want the flexibility of Jackson's TreeModel API
// Note: Jackson can also serialize standard Java Collections (Maps and Lists) to JSON: if you don't need JsonNode,
// it's simpler and more portable to have Spring JDBC simply return a Map or List<Map>.
package org.springframework.jdbc.core;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
@fungusakafungus
fungusakafungus / gist:1026804
Created June 15, 2011 09:42 — forked from unakatsuo/gist:1026755
bash retry function
function retry {
local retry_max=$1
shift
local count=$retry_max
while [ $count -gt 0 ]; do
"$@" && break
count=$(($count - 1))
sleep 1
done