Skip to content

Instantly share code, notes, and snippets.

@emacdona
emacdona / Main.java
Created June 23, 2011 13:13
Compound Interest and Rounding
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Main{
private static Transformer<BigDecimal> floor = new BigDecToDiscreteViaFloor();
private static Transformer<BigDecimal> ceil = new BigDecToDiscreteViaCeil();
private static Transformer<BigDecimal> round = new BigDecToDiscreteViaRound();
private static Transformer<BigDecimal> i = new BigDecIdentity();
@takimo
takimo / nodejs_express.js
Created June 25, 2011 01:34
nodejs_express
var express = require('express');
var app = express.createServer();
var Client, https, querystring;
https = require('https'),
querystring = require('querystring');
app.get('/', function(req, res) {
//res.send('Hello World');
@duksis
duksis / neighbor_search.py
Last active July 23, 2023 14:40
Script to find running web servers in local network
#!/usr/bin/env python
#########################################################################
# #
# Script for finding neighbor web servers in local network #
# #
# Author: Hugo Duksis <duksis@gmail.com> #
# Usage: python neighbor_search.py
# TODO: move pinging in multiple treads to increase performance #
# #
@Dreyer
Dreyer / mail-test.php
Created June 20, 2012 09:06
Quick & Dirty PHP Mail Test Script
<?php
/*
DONT FORGET TO DELETE THIS SCRIPT WHEN FINISHED!
*/
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = 'webmaster@example.com';
@kkarad
kkarad / BaseSpringTest.java
Last active March 6, 2019 07:41
SpringTest setup example with mock properties loaded during context initialization
package ork.kkarad.examples;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.mock.env.MockPropertySource;
@kristopherjohnson
kristopherjohnson / nodejs_snippets.js
Last active March 1, 2022 16:06
Random node.js code snippets
console.log('Hello, world!')
// Common modules
var util = require('util');
var events = require('events');
var http = require('http');
var url = require('url');
var fs = require('fs');
var zlib = require('zlib');
@ProLoser
ProLoser / alerts.html
Last active October 9, 2019 18:38
AngularJS Bootstrap implemented without any additional code
<h1>Alert</h1>
<p>Bootstrap JS</p>
<div class="alert fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
</div>
<p></p><a ng-click="alert=true">Open Alert (AngularJS)</a></p>
<div class="alert fade" ng-class="{in:alert}">
<button type="button" class="close" ng-click="alert=false">×</button>
@cole007
cole007 / Influential Abums
Created January 26, 2013 17:00
List of the 100 most influential albums, as listed on http://www.influentialalbums.com
The Pretty Things - S.F. Sorrow
Ride - Nowhere
Wire - Chairs Missing
The Jesus And Mary Chain - Psychocandy
Jimi Hendrix - Axis: Bold As Love
New Order - Technique
Harry Nilsson - Nilsson Schmilsson
Mazzy Star - So Tonight That I Might See
Captain Beefheart - Trout Mask Replica
Elliott Smith - Roman Candle
@JeremyMorgan
JeremyMorgan / database.class.php
Last active December 14, 2015 17:09
Simple PDO Database Class
<?php
/**
* File: database.class.php
* Super simple PDO class
*
* Author: Jeremy Morgan
*
* This is just a start. No error handling or parameterization yet
*/
@golonzovsky
golonzovsky / JaxbTest.java
Last active September 9, 2019 11:59
jaxb wrapper example for non-list elements
package com.test.ws;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;