Skip to content

Instantly share code, notes, and snippets.

View paolorossi's full-sized avatar

I don't run when I code paolorossi

View GitHub Profile
@dannypule
dannypule / json_to_csv.js
Created February 8, 2017 18:40
Export JSON to CSV file using Javascript
function convertToCSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var index in array[i]) {
if (line != '') line += ','
line += array[i][index];
@magnetikonline
magnetikonline / README.md
Last active September 21, 2022 05:34
Node.js HTTP receiving request dump server.

Node.js HTTP receiving request dump server

HTTP server which receives requests and dumps them to a flat file.

Usage

Start HTTP server:

$ nodejs ./httprequestdump.js
@cmmartin
cmmartin / moment-filter.js
Last active July 31, 2019 09:01
A generic Moment.js date filter for Angular.js
// REQUIRES:
// moment.js - http://momentjs.com/
// USAGE:
// {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n]
// EXAMPLES:
// {{ someDate | moment: 'format': 'MMM DD, YYYY' }}
// {{ someDate | moment: 'fromNow' }}
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active April 2, 2024 14:57
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active February 19, 2024 21:55
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
@chitan
chitan / WsChatServlet.java
Created July 7, 2012 01:44
How to use WebSocket of Tomcat
//This sample is how to use websocket of Tomcat.
package wsapp;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.util.ArrayList;
import org.apache.catalina.websocket.MessageInbound;
import org.apache.catalina.websocket.StreamInbound;
import org.apache.catalina.websocket.WebSocketServlet;
@iamkristian
iamkristian / log4jAdmin.jsp
Last active May 3, 2023 05:04
Change log4j log levels runtime from a jsp
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.log4j.Level" %>
<%@ page import="org.apache.log4j.LogManager" %>
<%@ page import="org.apache.log4j.Logger" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Arrays" %>
<%
/* This was originally suggested by Nelz on http://nelz.net/2008/04/08/log4j-runtime-configuration