Found this little experiment in the depths of one of my projects; I've removed it and dumped it here in case I want it in the future
/** | |
* DUMP | |
* | |
* Dumps a variable in a readable form to the console, this is a recursive function | |
* so be careful of nested references that may cause it to overflow... (untested for that) | |
* | |
* @v ANYTHING [Any variable] | |
* @name STRING [The name of the variable, optional, used internally when looping objects and arrays] | |
* @spacing STRING [The prefix spacing, used internally when looping objects and arrays] | |
*/ |
Once you have Titanium running, including Command-Line-Interface, this build script can be used with sublime-text to compile and pass to the attached android device. | |
Note that on windows you will probably need an additional "shell" parameter... | |
## Useful References | |
* https://wiki.appcelerator.org/display/guides/Titanium+Command+Line+Interface | |
* http://unbounded.io/post/28394170197/titanium-mobile-develpoment-with-sublime-text-2-and | |
* http://www.slideshare.net/cb1kenobi/exploring-the-titanium-cli-codestrong-2012 |
/** | |
* You can check if a number is a prime by looping the known primes to see if it divides. | |
*/ | |
// Seed the primes array | |
var primes = [2,3]; | |
// Start counting up... | |
myCounter : for(n=5; n<10000; n+=2){ | |
// Loop the known primes | |
for(p=0, l=primes.length; p<l; p++){ |
Inspired by the police.uk crime maps, where they cleverly cluster data together depending on how far zoomed in you are, this MySQL snippet goes a long way to explaining the logic behind such an operation.
This snippet groups sites to a perfect grid while the police.uk algorithm has some sort of trickery that moves their points about somewhat, looking at their blogs and documentation I would conclude that they have a predefined set of points, each with a catchment area of postcodes. It looks like a whole lot of scraping and manual labour went into their database and quite frankly I don't have the time nor inclination do attempt such a task.
This is a simple way to Sync a folder with Amazon S3 for a nightly backup - this is all to be done on your server :-)
this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc
# Install s3cmd
cd /etc/yum.repos.d/
Assign this little shell script to a keyboard shortcut Xfce to open a shell -prompt, then have that file / directory opened by it's native program.
Pretty simple, excellent user-experience!
Thanks to Xfce forum member "ToC" who helped me solve a problem with the script
// Build a deep object of some sort | |
var ob = { | |
type: 'windar', | |
title: 'Hello World', | |
children: [ | |
{ | |
type: 'BUTTUN', | |
title: 'click me', | |
}, | |
{ |
I think I'd like to write (for fairly perverse reasons) a script that will setup something like this on a CentOS server:
- Got CentOS?
- Got root?
- Update CentOS
- Set hostname, timezone etc
- Install Apache, MySQL, PHP, ImageMagick, S3cmd, Git etc.
- Setup Git with Apache user and pull from github / bitbucket to /var/www/html/
This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it
Sister Document - Backup MySQL to Amazon S3 - read that first
# Set our variables
export mysqlpass="ROOTPASSWORD"