Skip to content

Instantly share code, notes, and snippets.

View jimjamdev's full-sized avatar
🎯
Focusing

Ian Jamieson jimjamdev

🎯
Focusing
View GitHub Profile
@jimjamdev
jimjamdev / cassandra.cql
Last active September 24, 2015 12:22
Cassandra table set-up example
// Drop table
DROP TABLE cdr;
// Set up table
CREATE TABLE cdr (
id uuid,
imsi bigint,
calling_gt bigint,
timestamp timestamp,
text varchar,
function printInputValue(input, output, symbol) {
function updateOutput() {
$(output).html(input.val() + symbol);
}
$(input).on("input change", function() {
updateOutput();
});
updateOutput();
}
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.synced_folder "../yii-framework", "/yii-framework"
config.vm.provision :shell, path: "bootstrap.sh"
config.ssh.forward_agent = true
end
#!/usr/bin/env bash
apt-get update
apt-get install -y apache2 libapache2-mod-php5 php5-cli php5-mysql php5-curl php5-mcrypt
apt-get install -y curl
a2enmod php5
# Add ServerName to httpd.conf
echo "ServerName localhost" > /etc/apache2/httpd.conf
# Setup hosts file
VHOST=$(cat <<EOF
<VirtualHost *:80>
@jimjamdev
jimjamdev / Compare arrays
Created July 16, 2015 12:55
Comparing arrays in Yii
$settings = CHtml::listData(GeneralSettings::model()->findAll("`group` = 'email'"), "setting", "value");
$collectLogData = array(
"emailServer" => $post["emailServer"],
"emailPort" => $post["emailPort"],
"emailUsername" => $post["emailUsername"],
"emailPassword" => $post["emailPassword"],
"emailEncryption" => $post["encryption"],
"emailAuth" => $post["emailAuthentication"],
);
// Compare posted data array with currently saved settings array, and remove key if no difference
@jimjamdev
jimjamdev / BuildWithCraft Nginx
Last active August 29, 2015 14:05
Nginx Config for Craft CMS / BuildWithCraft
server {
listen 8080;
#listen [::]:80 default_server ipv6only=on;
root /var/www/craftsite.com/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name craftsite.com;