Skip to content

Instantly share code, notes, and snippets.

View cjpartridgeb's full-sized avatar

Chris Partridge cjpartridgeb

View GitHub Profile
@cjpartridgeb
cjpartridgeb / gist:cef5f89e17270127ff29
Created February 18, 2015 09:33
shizweak-launcher/config.json
{
"server": {
"ip": "203.33.121.111",
"port": "2302",
"steam_port": "2303"
},
"mods": [{
"name": "WSWeapons",
"display_name": "HLC Weapons",
"magnet": "magnet:?xt=urn:btih:sug2fqalfwvgvrvtctn2ysi5f3vzhrjy&dn=weapons.7z&tr=udp%3A%2F%2Fopen.demonii.com%3A1337",
var socket = require( 'socket.io' );
var express = require( 'express' );
var http = require( 'http' );
var mysql = require( 'mysql' );
var app = express();
var server = http.createServer( app );
var io = socket.listen( server );
function randomPosts(count, callback) {
entry.count(function (err, count) {
if(err) return callback(err);
async.times(count, function(n, done) {
var r = Math.floor(Math.random() * count);
entry.find({}, null, {limit: 1, skip: r}, function(err, post) {
if(err) return done(err);
return done(null, post[0].content);
});
function maxThrough(max) {
var b=0;
return through2(function(chunk,enc,callback) {
b+=chunk.length;
if(b>max) return callback(new Error('Too many bites!'));
this.push(chunk);
callback();
};
}
var express = require('express');
var nodemailer = require('nodemailer');
var app = express();
var port = process.env.PORT || 8300;
app.listen(port, function(){
console.log('Server is listening on ' + port);
});
require('http').request('http://www.google.com', function(res) {
res.pipe(require('through2')()).pipe(process.stdout);
}).end();
[
{
"id": 22298373,
"name": "AfterLands",
"full_name": "karan/AfterLands",
"owner": {
"login": "karan",
"id": 3261985,
"avatar_url": "https://avatars.githubusercontent.com/u/3261985?v=3",
"gravatar_id": "",
CREATE OR REPLACE VIEW form_details AS
SELECT fd.id, fd.template_version_id, fd.agency_id, fd.user_id, fd.name,
fd.template, fd.deleted, fd.finalised, fd.archived, fd.private, fd.generate,
fd.created, fd.updated, fd.archive_name, fd.parent_id, fd.signed,
fd.template_cost, fd.template_instruction_pages, fd.template_id,
fd.template_name, fd.template_orientation,
CASE
WHEN array_upper(fd.avids, 1) = 1 AND fd.avids[1] IS NULL THEN ARRAY[]::integer[]
ELSE fd.avids
END AS template_version_ids
@cjpartridgeb
cjpartridgeb / test.js
Created June 21, 2013 06:58
for yalamber
function export_connect_csv(user_id, res){
ConnectModel.mysqlPool.getConnection(function(err, connection){
res.header('Content-Type', 'text/csv');
var csv_header_row = "Email,First Name,Last Name,Status,Created\n";
res.write(csv_header_row);
var query = connection.query('SELECT * FROM connects where user_id = ? AND deleted = 0', [user_id]);
query
.on('error', function(err) {
@cjpartridgeb
cjpartridgeb / Vagrantfile
Created June 21, 2013 01:45
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.100.1"
config.vm.provision :shell, :path => "vagrant/bootstrap.sh"
end