Skip to content

Instantly share code, notes, and snippets.

.tooltip {
position: absolute;
padding: 10px 13px;
z-index: 2;
max-width: 600px;
color: #303030;
background-color: #f5f5b5;
border: 1px solid #deca7e;
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"sync"
)
@grom358
grom358 / dominion.js
Created August 21, 2012 06:47
Dominion Simulator for the base set
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach
if ( !Array.prototype.forEach ) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope || this, this[i], i, this);
}
}
}
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf
@grom358
grom358 / ldap.php
Last active December 4, 2015 02:44
<?php
class LDAP_Connection {
protected $ds;
protected $baseDN;
protected $hostname;
protected $port;
protected $binaryFields;
private $isConnected;
public function __construct($config = null) {
@grom358
grom358 / ksp_rename.php
Last active December 17, 2015 10:48
A PHP script for renaming the part folder names for better ordering when viewing parts in VAB/SPH and also for finding the part in Windows Explorer
<?php
// Category
// Pod is the first tab but is last for purpose of category numbers
$categoryNames = array('Propulsion', 'Control', 'Structural', 'Aero', 'Utility', 'Science', 'Pods');
$subcategoryOrder = array();
// Order of pod parts
// Pods are not separated into subcategory
@grom358
grom358 / ksp_ascent_sim.js
Last active December 21, 2015 06:39
Simulate ascents in KSP
var THRUST = 5;
var PLANET_RADIUS = 200000;
var PLANET_MASS = 9.7600236e20;
var PLANET_SIDEREAL_VELOCITY = 9.0416;
var G = 6.67384e-11;
var ISP = 350;
var FUEL_RATE = THRUST / (ISP * 9.81);
var TARGET_ALT = 40000;
var DRY_MASS = 0.39875;
var FUEL_MASS = 0.191025;
@grom358
grom358 / Formatter.php
Last active December 24, 2015 01:19
PHP Code Formatter
#!/usr/bin/php
<?php
/**
* PHP Token
*/
class Token {
public $type;
public $text;
public function __construct($type, $text) {
<?php
$nodes = node_load_multiple(NULL, array("type" => "webform"));
foreach ($nodes as $node) {
$save_node = new stdClass();
$save_node->nid = $node->nid;
$save_node->vid = $node->vid;
$save_node->type = $node->type;
$save_node->field_slsa_category = $node->field_slsa_category_1;
entity_get_controller("node")->resetCache(array($node->nid));
field_attach_presave("node", $save_node);
create keyspace weather with replication = {'class' : 'NetworkTopologyStrategy', 'AWS_VPC_US_EAST_1' : 3};
use weather;
create table city (cityid int, avg_tmp float, description text, primary key (cityid));
insert into city (cityid, avg_tmp, description) values (1,25.5,'Mild weather');
insert into city (cityid, avg_tmp, description) values (2,3,'Cold weather');
create table forecast(cityid int,forecast_date timestamp,humidity float,chanceofrain float,wind float,feelslike int, centigrade int, primary key (cityid,forecast_date));
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-10',0.76,0.1,10,8,8);
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-11',0.90,0.3,12,4,4);
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-12',0.68,0.2,6,3,3);
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) valu
ls -lh | cut -c55- | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/,/g'