This file contains hidden or 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 function executeSQL($dbh, $sql, $params = array()) { | |
try { | |
$stmt = $dbh->prepare($sql); //Used by all query types. | |
if (substr($sql, 0, 6) === "SELECT") { | |
//Select | |
$stmt->execute($params); | |
return $stmt->fetchAll(PDO::FETCH_ASSOC); //Returns an Array if data returned. Use is_array to check. | |
} else { | |
//Create/Insert/Update/Delete/Drop |
This file contains hidden or 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 NTMain() | |
{ | |
Include("libs/common/NTCommon.ntl"); | |
NTC_IncludeLibs(); | |
NTC_IncludeConfig("NTBot/char_configs"); | |
NT_LoadConfig(); | |
NTSI_LoadNIPFiles("NTBot/item_configs"); | |
NTA_Initialize(); |
This file contains hidden or 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 | |
////////////////////////////// | |
// Referreral Builder 1.0 | |
// Copyright 2011, Russ Jones, Virante, Inc. | |
/////////////////////////////// | |
// Assumes you create a table called | |
// ref_slots with 3 fields, url and ref, each varchar(255) and status, tinyint, REF should be primary key | |
$dbh = mysql_connect("localhost","username","password"); |
This file contains hidden or 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
(defun consolidate-spaces () | |
"Remove the continuous spaces before and after current point" | |
(interactive) | |
(let (start end) | |
(skip-chars-backward "[:space:]") | |
(setq start (point)) | |
(skip-chars-forward "[:space:]") | |
(setq end (point)) | |
(delete-region start end))) |
This file contains hidden or 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
require 'ipaddr' | |
IPAddr.new('1.2.3.4').to_i | |
IPAddr.new(16909060, Socket::AF_INET).to_s | |
This file contains hidden or 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 | |
/* license - GPL */ | |
/* this function will extract terms from the text, by Yahoo Query Language's search.termextract API */ | |
function extract_terms($content) { | |
$query = "SELECT * FROM search.termextract WHERE context = '" . str_replace("'", "", $content) . "'"; | |
$query_url = 'http://query.yahooapis.com/v1/public/yql?q=' . urlencode($query) . '&format=json'; |
This file contains hidden or 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
#!/bin/sh | |
MD5=md5 | |
function usage() | |
{ | |
echo bom_removal.sh file | |
} | |
function remove_bom |
This file contains hidden or 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
(defparameter *facebook-app-id* "id") | |
(defparameter *facebook-app-secret* "secret") | |
(defun facebook-login-p () | |
(let ((kvs (sort (map 'list (lambda (kv) | |
(split-sequence:split-sequence #\= kv)) | |
(split-sequence:split-sequence #\& (string-trim (list #\") (hunchentoot:cookie-in (format nil "fb |
This file contains hidden or 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
(defun solve-helper (primes candidates) | |
(let ((first-number (car candidates))) | |
(if first-number | |
(solve-helper (cons first-number primes) | |
(remove-if #'(lambda (n) | |
(declare (integer n)) | |
(= 0 (mod n first-number))) | |
(cdr candidates))) | |
primes))) |
NewerOlder