This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pairedChartColors(count) { | |
pairedSchemes = {3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]} | |
return pairedSchemes[count]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//.. | |
$foo = "foofoo"; | |
$bar = "barbar"; | |
$conn = new PDO('mysql:host=yourserverip;dbname=yourdatabasename', 'username', 'password'); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a Rails helper for generating a single chart for a column from a data set. | |
# blood_tests is the data set, and column_name is the column from the set to use. | |
# It calls generate_chart_row for each record, passing the column_name argument. | |
# It also does some stuff with vertical axis labels and chart options. | |
def generateChart(blood_tests, column_name) | |
data_table = GoogleVisualr::DataTable.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function myPostControllerFunction($someObject) { | |
$dispatcher = $this->get('event_dispatcher'); | |
$logger = $this->get('logger'); | |
$dispatcher->addListener('kernel.terminate', function ($event) use ($logger, $someObject) { | |
$logger->warning('This log entry was generated after Kernel Terminate and was passed an object of class: '.get_class($someObject)); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Form\FormEvent; | |
use Symfony\Component\Form\FormEvents; | |
use Symfony\Component\Form\AbstractType; | |
class MyFormType extends AbstractType | |
{ | |
public function buildForm(FormBuilderInterface $builder, array $options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// refile upload progress | |
var uploadsSuccessful = 0; | |
var uploadsFailed = 0; | |
var uploadsCompleted = 0; | |
var uploadsTotal = 0; | |
var progressBarParent = null; | |
$(document).on("upload:start", "form", function(e) { | |
$(this).find("input[type=submit]").attr("disabled", true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Either put the line below at /etc/crontab or in the Cron service package in the webui. | |
* * * * * root /usr/bin/nice -n20 /root/pinger.sh 192.168.1. >> /tmp/ping.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmap -v -sn 192.168.1.0/24 -oX /tmp/nmap-ping.log --append-output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project | |
has_many :project_items | |
has_many :features, through: :project_item | |
has_many :milestones, through: :project_item | |
# stuff | |
end | |
class ProjectItem |