Skip to content

Instantly share code, notes, and snippets.

self.previousWidth=window.innerWidth;
window.addEventListener("resize", function(){resizeApp();},false);
function resizeApp(){
if(window.innerWidth!=self.previousWidth){
self.previousWidth=window.innerWidth;
var mediaQueryList={};
window.innerHeight >= window.innerWidth ? mediaQueryList.matches=true : mediaQueryList.matches=false;
getOrientationValue(mediaQueryList);
}
#!/bin/bash
#
# Derived from -
# Joshua Davis
# http://shrubbery.mynetgear.net/c/display/W/Java+Daemon+Startup+Script
#
# This is a modification of the original script (which lets you run a java program as a deamon.
# look bellow for more information) that lets you run a groovy script as a deamon.
#
# ============== OLD SCRIPT TEXT ==============
@chfstudio
chfstudio / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<polymer-element name="my-element">
InputStream is = MyUtilities.readFile("nomefile.xls"); // Leggo un file XLS
SpreadsheetCompiler converter = new SpreadsheetCompiler(); //
String drl = converter.compile(is, InputType.XLS); // converto l'xsl in DRL
//Istanzio il motore di Drools
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newByteArrayResource(drl.getBytes(), ResourceType.DRL); //Aggiungo il DRL
KnowledgeBuilderErrors errors = kbuilder.getErrors(); //Controllo ovviamente gli errori
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
public class MySmallCache {
private static final long MAX_SIZE = 500;
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
import org.junit.Test;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
public class StackTest {
@Test
public void testMongoDBTestDataGenerate() {
MongoClient mongoClient = new MongoClient("localhost", 27017);
import groovy.transform.Field
def main(){
def cli = new CliBuilder()
cli.usage = 'groovy Test.groovy -e <environment-name>'
cli.header = '\nAvailable options (use -h for help):\n'
cli.with {
h(longOpt: 'help', 'Usage Information', required: false)
@chfstudio
chfstudio / 0_reuse_code.js
Created June 16, 2017 17:06
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
from Simulators.portfolio_optimal_composition import *
from Simulators.portfolio_optimal_composition_data import *
data_from_web = {
'mifid_max_score': 7,
'mifid_optimal_score': 5,
'portfolios_structure': [['CORE 1', 0.0, None], ['CORE 2', 1.0, None], ['CORE 3', 0.0, None], ['CORE 4', 1.0, None], ['CORE 5', 0.0, None], ['CORE 6', 0.0, None], ['CORE 7', 0.0, None], ['Global_Equity_H', 0.0, None], ['Power_Credit', 1.0, None], ['Alternative AbsRet', 1.0, 0.1], [None, None, None], [None, None, None], [None, None, None]]
}