Skip to content

Instantly share code, notes, and snippets.

View boycaught's full-sized avatar
🏠
Working from home!

.LAG boycaught

🏠
Working from home!
View GitHub Profile
component {
public function init() output="false" {
return this;
}
public function parse(data) output="false" {
local.links = [];
//loop over each line in the file
@boycaught
boycaught / generateRandomAlphaNumString.cfm
Created May 28, 2012 23:01
Generate random alphanumirc string of any length
<cfscript>
function generateRandomAlphaNumString(size) {
var _t = [];
for (i=1; i<=arguments.size; i++) {
if (randrange(1,2) eq 2) {_t[i]=chr(randrange(65,90));}
else if (randrange(1,2) eq 2) {_t[i]=chr(randrange(97,122));}
else {_t[i]=chr(randrange(48,57));}
}
@boycaught
boycaught / web-xml-urlrewritefilter
Created June 5, 2012 02:00 — forked from imageaid/web-xml-urlrewritefilter
Web.xml Settings for UrlRewriteFilter
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
@boycaught
boycaught / ajaxify-html4.js
Created June 6, 2012 23:44 — forked from balupton/ajaxify-html4.js
Ajaxify a Website using the HTML4 HashChange Functionality
(function(window,undefined){
// Prepare our Variables
var
document = window.document,
$ = window.jQuery;
// Wait for Document
$(window).bind(function(){
// Prepare Variables
@boycaught
boycaught / gist:3112362
Created July 14, 2012 17:53
CFScript Web Functions
<cfscript>
/**
* WEB FUNCTIONS
**/
remote any function getWebService(){
var targetUrl = '';
var webService = new http();
var content = '';
var thisresult = '';
@boycaught
boycaught / gist:3127569
Created July 17, 2012 06:21
CF+Java directory lister
<cfscript>
ourDirectory = expandPath(“./”);
directoryList = createObject(“java”,”java.io.File”).init(ourDirectory).list();
</cfscript>
@boycaught
boycaught / gist:3127580
Created July 17, 2012 06:24
CF+Java file downloader
<!--- suggested on: http://stackoverflow.com/questions/4738610/downloading-large-file-in-coldfusion-using-cfhttp --->
<cfscript>
source = 'protocol://domain/path/to/file.ext';
destination = getDirectoryFromPath(getCurrentTemplatePath()) & listlast(source, "/");
// bytearray routine
private binary function getByteArray (
required numeric size
)
output = false
@boycaught
boycaught / gist:4622976
Created January 24, 2013 15:23
CouchDB snippet:
// Nicked from: http://feedproxy.google.com/~r/cloudant/~3/3sqjw_b2Ekg/make-it-easy
// Dependencies: JQuery and sag.js (http://www.saggingcouch.com/)
$(function() {
// since I want to work locally (but use Cloudant data), I've set up a reverse proxy
// more on reverse proxy: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy
// use sag.js to connect
var user_db = 'my-Cloudant-database-name';
var couch = sag.server('my-server'); // localhost
couch.setDatabase(user_db);
@boycaught
boycaught / gist:5609923
Created May 20, 2013 01:41
AngularJS HTTP call skeleton, for posting to CouchDB (personal tutorial)
function CreateStoryController($scope, $http) {
// Create callback for success, injected into controller scope.
$scope.submitStory = function() {
var success = function(data, status, headers, config) {
$scope.message = 'Success!';
};
// Create callback for failure.
var failure = function(data, status, headers, config) {

Tutorial: Meteor in Windows using Vagrant

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on steps 8 to 15.

If you have no idea what I’m talking about, I’ve made a tutorial to install Ubuntu Precise x86 through Windows command-line with Meteor very simple to follow