Skip to content

Instantly share code, notes, and snippets.

View jamesjara's full-sized avatar

James Jara Web jamesjara

View GitHub Profile
@jamesjara
jamesjara / config.local.js
Created January 23, 2017 22:04
V1 versioning prefix for the REST path strongloop
var p = require('../package.json');
var version = p.version.split('.').shift();
module.exports = {
restApiRoot: '/api' + (version > 0 ? '/v' + version : ''),
host: process.env.HOST || 'localhost',
port: process.env.PORT || 3000
};
@jamesjara
jamesjara / .gitignore
Created January 13, 2017 22:17
git ignore config file for common javascript application - git ignore for ember.js
node_modules
dist
.tmp
.sass-cache
bower_components
@jamesjara
jamesjara / mongo_to_elastic_bukl_create.py
Created July 31, 2016 21:52
mongo to elastic bulk create
#!/usr/bin/env python3
mail = open('ssl_elastic.json', 'w')
for line in open('ssl_fixed.json', 'r', encoding = "ISO-8859-1"):
mail.write( '{ "create":{ }} \n' + line )
@jamesjara
jamesjara / import parse fix mongo to elasticsearch bulk
Created July 31, 2016 21:52
import parse fix mongo to elasticsearch bulk
# export mongo db as json data
mongoexport -d corex1 -c data -o data.json
# to fix " contains an unknown parameter [$oid]" need to delete key with JQ command
sudo apt-get install jq
jq -c 'del(._id)' data.json > tmp.$$.json && mv tmp.$$.json data_fixed.json
# also lets fix date field eg "t":{"$date":1463606674833}
# hardcoded time for now
jq -c '. + {t: 1469998152}' data_fixed.json > tmp.$$.json && mv tmp.$$.json data_fixed.json
@jamesjara
jamesjara / webviewclient.java
Created March 30, 2015 05:54
Android inject js or css to external page webview
//---- Appened STYLE
//document.getElementsByTagName('html')[0].innerHTML+='<style>*{color:#fff}</style>'
StringBuilder extraStyles = new StringBuilder();
extraStyles.append("javascript:(function extra(){");
if(getResources().getBoolean(R.bool.extraCss)){
extraStyles.append(
"var aa =document.createElement(\"link\");" +
"aa.type='text/css'; aa.rel='stylesheet'; "+
"aa.href='"+getResources().getString(R.string.extraCssUrl)+"';"+
"document.getElementsByTagName(\"head\")[0].appendChild(aa);"
@jamesjara
jamesjara / SEO 301 Redirect BLOGSPOT to Wordpress
Last active August 29, 2015 14:17
SEO 301 Redirect BLOGSPOT to Wordpress
Add to your blogspot blogger template
<meta expr:content='"0; url=http://www.jamesjara.com/redirect.php?a=" + data:blog.url' http-equiv='refresh'/>
@jamesjara
jamesjara / StopWordPresadding p tags
Created January 17, 2015 07:32
Stop WordPress from adding p tags and removing line break
Put at Atop of your template page
<?php remove_filter ('the_content', 'wpautop'); ?>