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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'rubygems' | |
require 'amqp' | |
require 'json' | |
EventMachine.run do | |
connection = AMQP.connect(:host => '192.168.100.10', :user => 'admin', :password => 'changeme') |
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
_ = require('lodash') | |
rpc = require('amqp-rpc').factory | |
url: "amqp://admin:changeme@192.168.100.10:5672" | |
exchange: "rpc_exchange" | |
rpc.on 'echo.*', (params, cb, callInfo) -> | |
if params.message | |
reply = { | |
echo: true | |
message: params.message |
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 capAndJoinWords(aryOfWords) { | |
return _.chain(aryOfWords) | |
.map(function(item) { return item + '123'; }) | |
.map(function(item) { return item.toUpperCase(); }) | |
.reverse() | |
.value() | |
.join(' '); | |
} | |
capAndJoinWords(['array', 'this', 'in', 'are', 'words', 'test']); // "TEST123 WORDS123 ARE123 IN123 THIS123 ARRAY123" |
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
alias grcl='git checkout master && git pull && git remote prune origin && git branch -avv | grep "gone]" | awk '\''{ print $1 }'\'' | xargs git branch -d' |
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
SUBSYSTEM=="tty", ATTRS{devpath}=="1.2", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="topmatrix" | |
SUBSYSTEM=="tty", ATTRS{devpath}=="1.3", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="bottommatrix" |
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 | |
if (!function_exists('getPageChooser')) { | |
function getPageChooser($pageLinks=array(), $activeIndexNumber=0, $previousText="Previous", $nextText="Next", $firstVisableNumber=1) { | |
// This function takes an array with links and makes a nice page chooser from it. | |
// The index of the array is 0 based, so is the activeIndexNumber. | |
// Make firstVisableNumber 0 if you want to see pagenumbers start with 0 (Why would you???). | |
$pagermenu = array(); | |
if (!is_array($pageLinks)) return ""; | |
$pageLinksCount = count($pageLinks); |
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 | |
#------------------------------------------------------------------------- | |
# Module: Cart - A simple example frontend form module | |
# Version: 1.0, calguy1000 <calguy1000@cmsmadesimple.org> | |
# | |
#------------------------------------------------------------------------- | |
# CMS - CMS Made Simple is (c) 2005 by Ted Kulp (wishy@cmsmadesimple.org) | |
# This project's homepage is: http://www.cmsmadesimple.org | |
# The module's homepage is: http://dev.cmsmadesimple.org/projects/skeleton/ | |
# |
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 | |
include 'lib/silk/silk.api.php'; | |
SilkDatabase::connect('mysql://root:@localhost/cms_innodb', true, true, 'cms_'); | |
$users = orm('user')->find_all(array('order' => "id ASC")); | |
var_dump($users[0]->full_name()); | |
var_dump($users[0]->groups[0]->name); |
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 | |
include_once('lib/silk/silk.api.php'); | |
$config = SilkYaml::load(join_path(ROOT_DIR, 'config', 'setup.yml')); | |
include_once('config/routes.php'); | |
//SilkDatabase::connect($config['database']['dsn'], $config['debug'], true, $config['database']['prefix']); |
OlderNewer