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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.turn(20); |
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
public class RegularExpressionMultiMatchAttribute : RegularExpressionAttribute | |
{ | |
public RegularExpressionMultiMatchAttribute(string pattern) | |
: base(pattern) | |
{ | |
} | |
public override bool IsValid(object value) | |
{ |
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
<? | |
/** | |
Written by James Laughlin | |
http://developer.pardot.com/discussions/questions/55-php-login-example | |
There seems to be little on this forum that is language specific, so If you are using Drupal or Wordpress, you'll need to build interfaces to Pardot in PHP at some point. Here's a function you can use to retrieve your Pardot credentials in one array object so that you can make your API calls. | |
**/ | |
// the pardot API key is only good for an hour | |
// so it's best to get it before every API call | |
function get_pardot_credentials(){ |
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 theme_pardot_webform_components_form($form) { | |
$form = $form['form']; | |
$rows = array(); | |
$output = ''; | |
$header = array(t('Name'), t('Type'), t('Pardot key')); | |
foreach (element_children($form['components']) as $k) { | |
$row = array(); |
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
var fileName = "file.xlsx"; | |
var connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;""", fileName); | |
var query = "select * from [{0}$]"; | |
using (var dataAdapter = new OleDbDataAdapter(string.Format(query, "worksheet name"), connectionString)) | |
{ | |
var dataSet = new DataSet(); | |
dataAdapter.Fill(dataSet); | |
var myTable = dataSet.Tables[0]; |
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
var sqlReader = sqlCommand.ExecuteReader(); | |
var products = new List<Product>(); | |
while(sqlReader.Read()) | |
{ | |
var product = new Product | |
{ | |
ID = int.Parse(sqlReader["ID"].ToString()), | |
Name = sqlReader[1].ToString() |
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
public List<ContactUsBizFormData> GetContactUsData() | |
{ | |
using (SqlConnection sqlconn = new SqlConnection(ConfigurationManager.ConnectionStrings["CMSConnectionString"].ConnectionString)) | |
{ | |
var sqlCommand = new SqlCommand(); | |
sqlCommand.Connection = sqlconn; | |
sqlconn.Open(); | |
var sqlReader = sqlCommand.ExecuteReader(); |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
namespace DataUtils | |
{ | |
/// <summary> | |
/// Derived from Richard Carr's (Black Wasp) CsvWriter class at http://blackwasp.co.uk/WriteCsv.aspx |