Notes

To self and beyond

Raspberry Pi Nodejs Open Zwave

sudo apt-get install make build-esential libudev-dev mkdir open-wave wget https://github.com/OpenZWave/open-zwave/archive/master.zip unzip master.zip cd open-wave make && sudo make install if node-gyp is acting up, just remove and install again. node...
Read more

Javascript Contract Development

JavaScript: Desing by contract. The javascript console has a little known method: assert. The idea is that you can place in your development code assertions such as: Model.prototype.setName = function(name){ console.assert(name); this.name...
Read more

Nodemcu Optimizations

Not enough memory https://github.com/nodemcu/nodemcu-firmware/issues/457 I could explain how to do this but I am not minded to on an issue list about bugs in the firmware. However in short, have you played with lua -i on your dev PC? you type in Lua...
Read more

Lua Global Pollution

I've been doing some work with the NodeMCU dev board using Lua, which is a great language. One thing that has been nagging me is that variables and functions are declared in the global namespace by default. This has been bothering me as I've been...
Read more

Sails Query by Relations

If you need to query a model by properties on a related model:
Read more

Mac Os Node Not a Directory Error

env: node\r: Not a directory npm install -g slack-cli slackcli env: node\r: No such file or directory The fix looks like brew install dos2unix find /usr/local/lib/node_modules/slack-cli -name "*.js" | xargs sudo dos2unix slackcli --help
Read more

Git Fails After Upgrading Mac Os

After upgrading Mac OS git would fail with the following error:
Read more

Nodemcu Pir Motion Detector

The PIR would read garbage, totally random values. The issue is that although the logic is 3.3v it has to be powered with at least 5v. The trickiest part was to figure out how to power the PIR from a NodeMCU which only has 3.3v Turns out some PIR...
Read more

Nodemcu Button Mqtt Example


Read more

Omnikey 5427 Mac Osx

The HID OMNIKEY 5427 CK is a PC/SC (CCID) compliant SmartCard...
Read more

Raspberry Pi Force Sensitive Resistor

https://acaird.github.io/computers/2015/01/07/raspberry-pi-fsr/ https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/connecting-the-cobbler-to-a-mcp3008
Read more

Raspberry Pi Pir Motion Python Nodejs

Wiring: GND -> 39 D01 -> GPIO21 #40 V -> 5v #2 picture npm i --save johnny-five raspi-io python:
Read more

Arduino Yun Install Pip

If you want to install pip on the Yún, you can follow this commands: The first thing you need to do is update the package manager. From here, we just follow the normal steps to install pip using easy_install We need to install python's openssl...
Read more

Python Amqp 406 Precondition Failed Auto Delete

tutorial 5 pika.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - inequivalent arg 'auto_delete' for exchange 'wework.dev' in vhost 'ivgdeswq': received 'false' but current is 'true'") The fix is just a configuration paramter: Routing...
Read more

Aws Dynamodb Gotchas

Things to consider: Item size: Cannot exceed 400 KB which includes both attribute name binary length (UTF-8 length) and attribute value lengths (again binary length). The attribute name counts towards the size limit. For example, consider an item...
Read more

Nodejs Waterline Error Cannot Read Property Identity of Undefined

While working with [waterline] I kept getting the following error: Cannot read property 'identity' of undefined It took me a bit to figure it out, but it turns out the problem was on the identity definition. After some fiddling around it turned out...
Read more

Golang Change Template Delimiters

The html/template package uses {{ and }} as default delimiters, which might conflict with any front end template logic that you might have on a served html. To fix this, you can change the value of the delimiters.
Read more

Golang Go Install Cli Tools

TL;DR If you install a package's binary with go install and you can't access the executable command from terminal, make sure that your go workspace's bin subdirectory is added to the $PATH.
Read more

Nodejs Cluster Docker

NOPE:...
Read more

Node Setimmediate vs Process Nexttick

The names of this two are counter intuitive since their behavior seems backwards. setImmediate is executed after nextTick. You might have used before a setTimeout with a time of 0 for instance to postpone emitting an event. setImmediate and nextTick...
Read more

Arduino Yun Node Evacuation Allocation Failed Process out of Memory

If you are working with an Arduino Yún trying to npm install a package and you get the following error: Evacuation Allocation failed - process out of memory You can disable the memory settings for node editing the file /usr/bin/node: However, it...
Read more

Nano Error Opening Terminal Xterm256color

If you like to use nano and get this error: Error opening terminal: xterm-256color unknown terminal type Here is a quick fix: Once you are in nano just type the commands again, exit and save. Thats it.
Read more

Mac Osx Brew Install Versions of Psql

To install and manage multiple Postgres versions on mac using brew, you can top tinto this repo: https://github.com/petere/homebrew-postgresql Then, you can brew install as needed. The formulae installed are "keg-only", meaning that they are not...
Read more

Leap Motion Bricked

I've had a leap motion for a while now, and recently a project surged for which the Leap would be perfect. Had not played with it for a bit, so when I opened the controller it asked to upgrade the firmware. After that the Leap motion stopped to...
Read more

Raspberry Pi Node Gyp Issues

I was having issues with node-gyp. I had to reinstall it One thing I noticed while doing the upgrade is that node was also upgraded, I had manually installed node_0.10.36-1_armhf.deb and it got upgraded to v0.12.0. Enable the Serial Port in the...
Read more

Python Running Multiple Environments

pip install virtualenv virtualenv myapp cd myapp source bin/activate which python3 /usr/local/bin/python3 virtualenv -p /usr/local/bin/python3 openssl s_client -connect 192.168.0.1:443 -CAfile python -c 'import requests...
Read more

Raspberry Pi Set up Enable Ssh Login

cd ~ mkdir ~/.ssh cat keys.txt > authorized_keys chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys Edit the ssh config file /etc/ssh/sshd_config sudo nano /etc/ssh/sshd_config Somewhere in this file (usually on page 2 – CTRL+V for next page)...
Read more

Raspberry Pi Setup from Image

./flash --ssid WeWorkCopr --password Cr3@t0r$ ../DISTROS/2015-02-16-raspbian-wheezy.zip mdkir CODE
Read more

Ssh Warning Remote Host Identification Has Changed

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be...
Read more

Raspberry Pi Autoconnect to Wifi

wpa-roam does this exactly. https://www.raspberrypi.org/forums/viewtopic.php?t=11517 http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/
Read more

Raspberry Pi Build Your Own Wheeze Img

Resources...
Read more

Raspberrypi Docker

./flash --hostname freshpi --ssid vitaminag --password camchacka ~/Downloads/hypriot-rpi-20150329-140334.img.zip
Read more

Python Parse Boolean Values with Argparse

I was writing a small python script which was using argparse to handle command line arguments.
Read more

Raspberry Pi Init D Script Node App

Once you have developed an app that you want to run on your Raspberry Pi you need to find a way to have it running on the background and possibly to start on boot. There are different ways to go about it, but a simple and effective one is to use...
Read more

Raspberry Ip Mac Address Tracking

First, you need to find the MAC address of the device you want to track. If you have an iPhone you can find it under Settings > General > About > Wi-Fi Address.
Read more

Git Serve Local Repo to Lan

Sometimes you don't want to create a remote repository. Or your remote is down. For whatever reason, you might want to serve a repo over your local network without too much trouble. Note that is an insecure way of sharing a repo. One way of doing...
Read more

Raspberry Pi Assign Local Domain

Instead of accessing a Raspberry Pi by it's IP address I find it easier to assign it a .local domain. I work on a Mac which comes with Bonjour. On the Raspberry Pi I use Avahi. Fist update your pi: Installing Avahi is as simple as typing the...
Read more

Vagrant Raspberry Pi Workflow

Workflow: Use Vagrant to manage the state of the image on your dev box Use qemu-img to convert the vmdk to an img file Flash that to the SD card Vagrant file Reads: Why port Docker to the Raspberry Pi? Docker Running...
Read more

S3 Serve Static Website

Setup You can use S3 to host a static Website using a regular bucket. Create a bucket and give it a sensible name- domain of your site. Select the region where you want to create the Bucket. You can then upload all static assets from your...
Read more

Arduino Yun Web Server

The cool thing about the Yún is that it comes with a built in web server. NOTE: At this point, you should know how to connect to your Yún using WiFi and through your server. Also, you should have expanded its memory. [LINK TO PREVIOUS POSTS] An...
Read more

Nano Arduino Yun

Yes, I prefer nano over vi. If you try to use nano on your Arduino Yún you might get the following error: Error opening terminal: xterm-256color. To get rid of that error, type this command into terminal: This change would only last for the current...
Read more

Setting up Nodejs Arduino Yun

The Arduino Yún runs a Linux distribution based on OpenWrt named OpenWrt-Yun. It actually runs an ATmega32u4 microcontroller and a Atheros AR9331 processor. To connect via SSH, you need the IP address of the Yún, the admin password. The computer...
Read more

Raspberrypi Installing Node

To install node in the raspberry pi, you can use the deb packages distributed by the node-arm app, which is an open source express app hosted on heroku. Source code available on github. At the time of writing this, there were four build...
Read more

Raspberrypi Installing Ngrok

ngrok is an amazing service. This is how is described in their website: Introspected tunnels to localhost "I want to securely expose a local web server to the internet and capture all traffic for detailed inspection and replay." And that is exactly...
Read more

Javascript Marked Play Nice with Highlightjs

TLDR; You need to use the langPrefix option to include hljs class. Let me start by saying that marked is awesome. However, if you want to use highlightjs with marked you might run into the issue of your tags not having a proper background. That is...
Read more

Javascript Momentjs Deprecation Warning Moment Constructor Fall Back to Js Date

Moment: Deprecation warning: moment constructor fall back to js Date Working with moment.js in node I kept getting the following deprecation warning: Deprecation warning: moment construction falls back to js Date. This is discouraged and will be...
Read more

Arduino Forbids Comparison Between Pointer and Integer Error

Arduino: ISO C++ forbids comparison between pointer and integer Following a simple hello world example for the Arduino Yún got me for a second. The error output was the following: The code for getTimeStamp is as simple as this: This time around...
Read more

Arduino Forbids Charting

Arduino: ISO C++ forbids comparison between pointer and integer Following a simple hello world example for the Arduino Yún got me for a second. The error output was the following: The code for getTimeStamp is as simple as this: This time around...
Read more

Javascript Deprecation Warning Moment Constructor Fall Back to Js Date

Moment: Deprecation warning: moment constructor fall back to js Date Working with moment.js in node I kept getting the following deprecation warning: Deprecation warning: moment construction falls back to js Date. This is discouraged and will be...
Read more

Note to Self Slakr User Token

Slakr To get a user token go to: https://api.slack.com/web
Read more

Open Source Alternatives to Twilio

Open Source alternatives to Twilio Twilio is an excellent product. I've used it in some projects with high performance demands where reliability was critical and I could not been happier. However, is always good to have alternatives, and more so if...
Read more

Python Fata Error No Such File or Directory Python H

Solve Fatal Error: Python.h No such file or directory While installing zeroconf, pip failed with the following error: netifaces.c:1:20: fatal error: Python.h: No such file or directory To solve it, install python dev: If apt-get fails to find the...
Read more

Mac Terminal Batch Rename Files

Batch rename files from terminal A one liner to batch change file extensions from terminal. In this example we are graving all files with a txt extension in the current directory and updating the files with a md extension:
Read more

Raspberry Pi Bonjour

Raspberry pi bonjour Using avahi-daemon: On mac terminal: Configuring avahi-daemon Now wouldn’t it be nice if the Mac showed your Pi under the shared section of the Finder sidebar? For this the Raspberry Pi needs to be advertising itself on the...
Read more

Mac Capture Ip Mac in Lan

!-- http://www.fresymetal.com/como-detectar-intrusos-en-tu-wifi-con-raspberry-pi/ --
Read more

Raspberry Pi Wifi Monitor

Raspberry pi wifi monitor I was trying to use the raspberry pi to monitor traffic on my LAN using the Wi Fi dongle that came with the raspberry pi, a realtek- RTL8188CUS. It does not work. Typing iwconfig on terminal: Looking around, I found this...
Read more

Raspberry Pi Command Not Found

Raspberry Pi: command not found I was trying to use a BLE dongle with a raspberry pi, and got this error: command-not-found There is a package command-not-found that provides help. After you install it, you need to update the database: sudo...
Read more

Raspberrypi Sudo Node Command Not Found

/opt/node/bin/node lrwxrwxrwx 1 pi root 26 Jan 18 01:57 /opt/node -> node-v0.10.28-linux-arm-pi /usr/bin/node lrwxrwxrwx 1 root root 18 Mar 1 01:47 /usr/bin/node ->...
Read more

Raspberrypi Unicorn Hat

Unicorn Hat Not working: Includes 40 pin GPIO ribbon cable Power supply You can use rpi-ws281x-native
Read more

Note to Self Python Remove Duplicated Dicts from List

Python: Remove duplicate dicts from list You have a list of dicts and want to remove duplicates. You can use a list comprehension: If you open the python rpl:
Read more

Note to Self Generate Timestamps

Generate UNIX timestamps JavaScript: Java: Python: Ruby: Erlang: PHP: MySQL:
Read more

Raspberrypi Ftpsync Sublimetext

Remote edit files in raspberrypi To work in your computer and sync files to the raspberry pi you can use the package FTPSync, repo here Your config file should look similar to this one: Setup FTP in raspberry pi We can use a simple FTP server, vsftp...
Read more

Raspberry Pi Python Install Pip

How to install pip on raspberry pi One way to install pip on your raspberry pi: Setup tools include easy_install, which you can use to install pip: If you have multiple versions of Python- or are running Python 3- then use the specific easy_install...
Read more

Raspberry Pi Setup

raspberry pi remove wolfram install node: Install cmake: Installing raspicam: Download from SourceForge tar xvzf raspicam-0.1.1.zip cd raspicam-0.1.1 mkdir build cd build cmake .. Output should be something in the lines of: If you had opencv...
Read more

Python Opencv Mac Os

Python openCV on Mac OS Install openCV with brew: After brew is done installing you might get this warning: ==> Caveats Python modules have been installed and Homebrew's site-packages is not in your Python sys.path, so you will not be able to...
Read more

Nodejs Sudo Npm Command Not Found

sudo npm command not found Use which npm:
Read more

Npm Postinstall Script

NPM package.json: postinstall script A feature I did not know about npm is the ability to run post install scripts. Here is a list of all the suported script tags: prepublish: Run BEFORE the package is published. (Also run on local npm install...
Read more

Mac how to Make Icns

Make icns from Iconset:
Read more

Node Upgrading Socket Io 0 9 1 X

Upgrading socket.io from 0.9 to 1.x You can follow the [migration docs][migration-docs] at socket.io's website. Since io.set is gone, in my case, on the server app I had to convert form this: to this: Logging is now based on debug, so to print only...
Read more

Node Growl Mocha

Run growl with mocha tests, MacOS mocha is a great testing framework. It has a flag to use growl notifications. The command to run using the watch feature and growl: This way you are supposed to be able to run the tests on the background and get...
Read more

Python Help Built in Function

Python "help" function Python has many built-in functions globally available. I'm sure most are familiar with dict, int, str, or even zip. Today I came across the help function: help([object]) Invoke the built-in help system. (This function is...
Read more

Node Current Working Directory

Get current working directory from CLI script To get the directory from which your command tool/script has been called you can use the cwd method of the global object process:
Read more

Ios Core Data the Model Used to Open Store Incompatible One Create the Store

NSCocoaErrorDomain Code: 134100 During development, this error can appear while adding pre populated data in a new project or after modifying entities in a CoreData model. The model used to open the store is incompatible with the one used to create...
Read more

Xcode 6 Empty Application Gone

Xcode 6 removed Empty Application As a workaround, you can add the old templates. Download files from here. Then place the directory inside the Xcode app- right click Xcode and select Show Package...
Read more

Git Rename Local Branch Update Remote

Rename git branch local and origin Rename a branch locally, we then delete the old branch, and push the new branch to origin, setting the local one to track remote.
Read more

Objective C Retain Cycle

Objective-C: Retain cycle Objects in a hierarchy are created, owned and freed in a chain along the hierarchy. In its most simple form, a retain cycle occurs when two objects keep a strong reference to each other since both objects do retain each...
Read more

Mac Osx Simple Webview Application

Simple Mac OSX application with WebView Create a new project in Xcode: Select OS X > Application > Cocoa Application After you have created the project, select the app delegate header file. Add WebKit framework Go to target settings, General tab...
Read more

Mac Osx Terminal Copy Paste Commands

Mac OSX: Copy to clipboard terminal command To copy the contents of a file to the clipboard is pretty straight forward on a Mac terminal: To paste the contents of the clipboard into a file:
Read more

Wolf Cms Content Not Found 404

Wolf CMS 404 Error page I have a legacy website that runs on the Wolf CMS. I got an email from the owner informing me that suddenly the website was unaccessible and rendering the following error message: Apparently, Wolf CMS shows the reported error...
Read more

Ffmpg Convert Gif to Mp4

FFmpeg: Convert gif to mp4. There is a guide on the FFMpeg trac site that describes how to create a video from a sequence of images. One command extracted from that guide: Another command:
Read more

Sass Compass Grunt Error

Compass Error: require cannot load such file. Running a compass grunt task that had been working fine, suddenly started failing with the following error: It turns out that the main error is due to an incompatible sass and compass versions- I had...
Read more

Functional Notes

Purity and Referential transparency Push side effects to the outer layers of the program. Architect code with a pure core and a thin layer on the outside handling effects. A pure function is a function without side effects. Referential transparency...
Read more

Bash Terminal Pipe Status Command

Exit status REDO!!! If you execute a bunch of piped commands, and somewhere in the line a process fails, bash reports that the pipeline executed without errors because bash only reports the status of the last process. To get the status of every...
Read more

Temporarily Overwrite Instance Method

Temporarily overwrite instance method We can overwrite the prototype method with our custom greet method. When we are done, we can delete the instance's method so that the prototype methods get used instead.
Read more

Grunt Warning Error Template Lodash

Grunt: Error processing template, lodash barks: After cloning a repo in a new machine, I kept getting this error when running grunt: Warning: An error occurred while processing a template (_ is not defined). Use --force to continue. It was a little...
Read more

Javascript Dynamically Create Arrays

Dynamically create Arrays to iterate var a = new Array(10); a[0] // returns undefined a.length // returns 10, because of reasons. The following example will NOT put anything to the console, because creating an array with length initialization will...
Read more

Javascript Wtfs

JavaScript Where WTF is 0... The equality operator translates to this:
Read more

Scala Play Cors No Access Control Allow Origin

Play for Scala: CORS error Trying to implement a CORs filter to handle GET and POST requests kept failing. The error returned on each POST: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3003'...
Read more

Javascript Dynamically Array One Liner

JavaScript: Dynamically create and populate array in one line
Read more

Ractivejs Template in Line Arguments

Ractive.js: Component keys Component passing data to instance using template in-line arguments lower cases the keys. It turns out this is because you're using a for the template and not a tag: http://jsfiddle.net/tzxesca7/2/.
Read more

Websocket Closeevent Reason Length

WebSocket: reason argument Per the w3 TR: If reason is longer than 123 bytes, then throw a SyntaxError exception and abort these steps. Good to know if you are implementing a WebSocket server.
Read more

Note to Self Sublime Text File Multi View

Note to self: Sublime file multi view To view the same file on multiple tabs, from the File menu: File > New View into File
Read more

Note to Self Mac Os Terminal Find Process by Port Number

Find process listening to an specific port number (Mac) This has happens often enough to be a problem but not often enough for me to remember the command. If you need to find the process listening to an specific port number, and then kill it, you...
Read more

Forcing Schema to the Front End

Forcing the schema onto the front end By using a schema less Platform, we are forcing the job to the front end. There is a logical point in which it will brake. JavaScript has many strengths, but type safeness is not one of them. Basically, we are...
Read more

Aws

Amazon Web Services Amazon's JavaScript SDK ships with default support for DynamoDB, S3, SNS, SQS, Kinesis, CloudWatch, and STS. Amazon Kinesis One common use of Amazon Kinesis is real-time aggregation of data to be then consumed into a data...
Read more

Javascript Hate It Aws Sdk

JavaScript: Love it or Hate it I love JavaScript because I can do whatever I want with it. I have JavaScript because you can do whatever you want it it. Hate Everybody can use it. Most developers miss use it. Here, example from AWS JavaScript SDK:
Read more

Git Compare File Between Branches

Git: compare file between branches If you need to compare a file between two branches
Read more

Javascript Check Range

Check number falls in range
Read more

Nodejs Sailsjs Forever

Run sails with forever. Install forever: Assuming you already have sails installed and have created an app, cd to the root directory of your app. Add a .foreverignore, using nano: List files to be ignored by forever on relaod: NOTE: If you...
Read more

Javascript Tilde Shortcut Indexof Check

Bitwise NOT operator or tilde shortcut: You can use Array.prototype.indexOf to check the position of an item in an array. If an item is found it returns the index of the item, if the item is not found it returns -1. The bitwise NOT operator will...
Read more

Swift Range Operators

Swift: Range operators Swift includes two range operators, two dots, three dots. The closed range operator (a...b) defines a range that runs from a to b, and includes the values a and b. The half-closed range operator (a..b) defines a range that runs...
Read more

Ractivejs Lifecycle

Ractive: Life cycle Ractive 0.4.0: A teardown event will be fired before the component is removed from the DOM. ```javascript var ractive = new Component({ init:function(){ this.on('teardown', function(){}); ...
Read more

Ractivejs Components

Ractive: Components This does not work: This seems to work:
Read more

Ffmpeg Gists

ffmpeg: Convert mov to mp4 Convert from mov to mp4: ffmpeg -i movie.mov -vcodec copy -acodec copy output.mp4 To do compression: ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4 Calculate the bitrate you need by dividing 1 GB by the video...
Read more

Mac Osx Reset Admin Password

MacOSX: Reset admin password Let's say that someone gained access to your computer and changed your main user's password as a prank. You notice when can't sudo and when you type in your old password, it does not work. Sadly, its actually really easy...
Read more

Note to Self Css Ids Cant Start with Number

Note to self: CSS id's can not start with a number Using an id that starts with a number break CSS. ID or classes are not allowed to start with a number. In CSS2, identifiers (including element names, classes, and IDs in selectors) can contain only...
Read more

Mac Osx Find Files by Size

Mac: How to find files by size in terminal Piped with other commands: File size To see the size of files: Size switch
Read more

Mac Osx Slow Finder Mavericks Beach Ball Party

Mavericks: Slow Finder So, I recently bought two new MacPros, both came with Mavericks. Finder has been acting up, being extremely sluggish, and beach balling all the time. Checking the console app, I saw tons of this messages: XPC error messaging...
Read more

Note to Self Terminal Batch Rename

MacOS X: Terminal, batch rename files: Simple onliner to batch rename files by extension. Or using sed: On OSX you may encounter sed: 1: "...": invalid command code. It seems that -i option expects a file extension. You can pass an empty string as...
Read more

Self Note Mac Osx Enable Quicklook Select

MacOSX: Enable quicklook text selection: In order to select text from a preview, enable this in terminal:
Read more

Grunt Php Spawn Enoent Error

Grunt Error: Fatal error: spawn ENOENT I just switched computers, moving projects slowly to the new one as I've been working on them. I started working again in a front end project that uses Grunt to manage work-flow and the tool-chain. The peculiar...
Read more

Karma Aborted Due Warnings Phantomjs

Karma: Aborted due warnings unhelpful error I really enjoy testing with karma. However, there is something that drives me nuts about it: Aborted due to warnings. Could there be anything more fucking unhelpful? It took me a while to figure out...
Read more

Git List Branches Ordered Recent Commit

Git Git, list all branches ordered by recent commit:
Read more

Javascript Repeat a String N Times

JavaScript: Repeat a string n times. This is one of those things that you know how to do in one language, say Python, and you find yourself wanting to use in another language, say JavaScript. So, there is how you can achieve this in JavaScript:
Read more

Nodejs Express Autodiscover Routes

Node: Autodiscover routes In your server.js file: Then, your route files would look like this:
Read more

Mysql Error 1449 the User Specified as a Definer Does Not Exist

Mysql Error #1449 1449 - The user specified as a definer ('username'@'%') does not exist Basically, MySQL is wining about the user that created a procedure is now undefined. It could have been deleted or it could be that you copied a mysql_dump and...
Read more

Javascript Regexp Match Content Between Html Comments

JavaScript: RegExp to match content between HTML comments. I'm sure you are familiar with the following quote: Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. And, if you...
Read more

Grunt Karma Require

Karma, require, dependencies path issue If you get a similar error message: Running "karma:unit" (karma) task ERROR: 'There is no timestamp for /base/app/js/services/platformclient.js!' It probably means that the file is not available in the...
Read more

Grunt Cli Error

Grunt: How to get rid of the grunt warning: Local Npm module "grunt-cli" not found. Is it installed? I solved that annoying error message by moving grunt-cli from the devDependencies to peerDependencies.
Read more

Node Get Rid of Npm Sudo

NPM: Requires sudo to install If npm requires you to sudo to install, then you should reclaim ownership of npm: You also need to reclaim your local library:
Read more

Vagrant Vbox Power Off Multiple Machines

Alias to power of multiple VBox: https://github.com/joshmcarthur/vagrant-list
Read more

Vagrant List Available Network Interfaces

On boot:
Read more

Mac Osx Terminal Compare Directories with Diff

Use diff to compare directories We can use diff to compare two directories in terminal. To make it recursive, use the -r option: To get less verbose output, use -q option: I also find it useful to pipe the output to a text file:
Read more

Compass Sass Error

# For some reason, compass seems to be pulling a broken version of sass.
Read more

Php Session Safari Bug

PHP session empty on Safari. The simptom, blank page on some Safari browsers, working as expected on Chrome and FFox. I had this issue on a simple php application, after the login page
Read more

Mac Osx Enable Json Preview

Enable json preview https://github.com/rjregenold/jsonlook
Read more

Mac Osx Markdown Preview

Enable Markdown preview in MacOs One thing that has been annoying me lately is the lack of file preview for Markdown files in MacOs. There is an open source project, qlmarkdown that brings d to QuickLook, Get the binaries here, the latest release is...
Read more

Php Self Referencing Closures

PHP self referencing closures In order to make closure recursive calls, we need to pass a reference to self. If you don't pass $parser by reference, it will be null which is it's value at the time you pass it.
Read more

Is Not a Bug Its a Feature

It's not a bug, it's a feature So, I don't remember when was the first time I ever heard that phrase. I always felt that it was meant to be a cheap developer excuse and I just left it at that. Let me tell you a little history. I got thrown into a...
Read more

Mac Osx Private Var Vm Sleepimage

Mac OS: Reclaim disk space So, I've been having issues with my MacPro. It has a new SSD hard drive but from time to time, it will start swapping and claim there is no more disk space left on the computer. I started looking for large files: The...
Read more

Git Move Directory from Repo to New Repo with History

Move a directory from a git repository to its own repository, with history You can use filter-branch To rewrite the repository to look as if foodir/ had been its project root, and discard all other history:
Read more

Mac Osx Brew 404 Error Git Local Changes

Brew herrors: While doing a brew search I got this output on the terminal: Apparently, that means that you need to brew update. Aparently, a local file got modified and broke the repo. TODO: how does brew store/manage formulas? A quick fix would...
Read more

Note to Self Mac Os Terminal Word Count

Count the number of lines, words, and characters of a text file, mac. wc will give you counts for print newline, word, and byte for a specified file. You can see the explainshell entry here, wc explained. w: words c: characters Total number of...
Read more

The Hardest Bugs

Thougtest BUGs Thinking about bugs, I can think of three buckets to classify them. Implicit acceptance that base conditions are ok: The bug is in the language that you are using, PHP, MySQL* Panic induced: Late night deployment, you are tired. You...
Read more

Php String Template

PHP simple string template method A rather simplistic function to interpolate strings and replace tokens by the values found in a provided context. Consider the following example:
Read more

Vagrant Chown Silently Fails

Vagrant fails to change file permissions in synced folder Setting up a LAMP Vagrant sandbox, I kept running on different issues that boiled down to this: I could change/set permissions for files and directories outside the vagrant synced folder, and...
Read more

Pro Tip Alternative Assignment

PHP Alternative assignment In JavaScript you can use the following sintax: In PHP 5.3 the equivalent syntax would be a imaginative use of the ternary operator. If you want to use the logical or operator, || you would have to take a roundabout.
Read more

Php Echo vs Print

PHP: Difference between echo and print Going over some PHP code I noticed that echo and print were being used [almost] interchangeably. Print takes only one parameter Another difference is that while echo can take multiple parameters, print only...
Read more

Sublime Text Execute Php Scripts

How to execute PHP from SBT If you want to quickly test your PHP scripts from within Sublime Text you have to add a build file. Go to Tools > Build System > New Build System That should bring a new file, you should place the following inside: In my...
Read more

Javascript Remove Console Statements

JavaScript: Remove console statements There are a few tools to remove console statements on your production code. groundskeeper or grunt-remove-logging both let you remove console.* statements, or specify a patter to match your own logger...
Read more

Article Todo Mvc 2 Hmvcp

TODO: Rewrite the code in this article mvc-with-js to refactor it and express a simpler way of doing things. MVC is a design pattern that breaks an application in three layers: Model: Handling data (Model). View: Presentating data to the...
Read more

Note to Self Mysql Create User

MySQL: Create user Quick note, create user in MySQL CLI: Login into mysql: If you need to delete a user: To revoke permissions: Test new user: Login again with the new user: User permissions: CREATE Create new tables or databases DROP Delete...
Read more

Note to Self Apache Install Module

Activate module in apache To activate the module: Then, restart apache:
Read more

Apache Redirect Domain to Localhost Port

Apache: Redirect domain to localhost port When setting up a local development environment, sometimes you mihgt want to forward a domain to any app running on localhost:port a connection. For instance, if you are using Vagrant.
Read more

Rant Personas the Inmates Are Running the Asylum

Personas http://alanklement.blogspot.com/2013/03/focus-on-relationships-skip-personas.html Been reading the book The Inmates are Running the Asylum, by Alan Cooper. They are made up and not real. This means they are full of errors and prejudice.
Read more

Pro Tip Serialize Properties Cache Id

Serialize object properties as key for cache Simple idea, how to invalidate cache? Simple pattern would be to have the sate of the object reflected in its cache id. Serialize its properties and values as the id.
Read more

Pro Tip Event Dependencies

Simple interface to prevent event dependencies Oftentimes I hear that event introduce dependencies in your code. It's somehow true. A simple patter I use, have a method that returns system wide event name dependencies, and a hub method to handle all...
Read more

Pro Tip Naming Conventions

Naming conventions as fat burner. I like to follow conventions, specially naming conventions. They are a good thing. No need to be as radical as Rails, but to a degree that is not a hidrance and it's easier to figure out the conventions rather than...
Read more

Pro Tip Hierarchical Configuration

Configuration strategy It's nice to have a configuration strategy in place where you can cascade overrides at different levels, where options specified in the lower level are overriden by the ones closer to the user. gconfig, TODO: MAKE PHP...
Read more

Php Static Factory

PHP: Inherited factory method In PHP, you can use the keyword static inside a factory method to get a reference to the current class at runtime- as opposed to self that would return the original class in which the method was originally defined. This...
Read more

Run Php in Grunt Project

Execute PHP in a Grunt based web project I do some fair amount of work in PHP, and gateway connect-modrewrite
Read more

Php Array Filter by Key

How to filter arrays in PHP by key Assuming we have an array with keys we want to retrieve from $_REQUEST What would be the best way to filter $_REQUEST based on $allowed keys? The simplest would be to use: Other implementations One solution would...
Read more

Git Numeric Version


Read more

Note to Self Django Jquery Namespace

Note to self Django: undefined jQuery Django loads jQuery as a dependency and stores it under the django namespace. To access the jQuery loaded by django you would use django.jQuery. Using a module pattern to define a module that has jQuery as a...
Read more

Note to Self Python Double Underscores Name

Note to self Python: Whats the conventional name for double underscores Python is riddled with tons of magic words, reserved for the core developers. There is a suggested shorthand for those awkward names: dunder for Double UNDERscore. You can read a...
Read more

Javascript Object Hasownproperty

JavaScript: Object.hasOwnProperty A coworker asked me today about JavaScript Object's hasOwnProperty method, and how do I use it. I figured I would just
Read more

Jquery Check if Selector Null

jQuery: Handy selector null check In jQuery, if you want to check if a selector exists or not you could check the length property, or use the size method. However, by extending the fn with a simple method we can get some nice flow. Then, we can use...
Read more

Note to Self Requirejs Jquery Bootstrap

Note to self RequireJS, jQuery and Twitter Bootstrap If you want to use Twitter Bootstrap with require, you need to declare jQuery as a dependency for bootstrap. The following setup uses the CDN script of both jQuery and bootstrap and provide a local...
Read more

Javascript Get Object Type

Object.prototype.toString( ) When the toString method is called, the following steps are taken: Get the [[Class]] property of this object. Compute a string value by concatenating the three strings “[object ", Result (1), and "]“. Return Result...
Read more

Note to Self Enable Cors Htaccess

Note to self Enable CORS in htaccess Ajax crossdoamin issues, or the following error on any ajax request: Origin is not allowed by Access-Control-Allow-Origin
Read more

If the Product Is Free You Are the Product

If the product is free, you are the product. Just saying. Nothing more
Read more

Sublime 3 Markdown Reference Links Plugin Example

Simple Sublime Text 3 plugin example
Read more

Note to Self Mac Osx Create File of Size

Note to self Create file of size Sometimes, I need a file of a certain size to test something out. Turns out there is a simple utility you can use from terminal.
Read more

Note to Self Mac Os Terminal Run Last Command

Note to self Run last command Simple shortcut that stands in place of your previously written command: Yup, that's it. This is useful after having typed a long command, we find out it needed root privileges. To enter the last command again but with...
Read more

Node Find if Script Is Required or Invoked from Cli

Note to self Node: Find if script is required or invoked from CLI Analogous to python's if __name__ == '__main__': in node you can test if a file is being directly invoked from CLI as follows:
Read more

Php Phpunit Error Seleniumtestcase

PHPUnit Error: SeleniumTestCase From time to time I keep seeing this error when I try to run PHPUnit. I always seem to be able to fix it, and forget abut it. So, note to self: If you can't run PHPUnit, and you get error/warnings that look like the...
Read more

Python Wsgi Script Does Not Contain Application

Target WSGI script 'x' does not contain WSGI application 'application' Well, believe it or not, the error is what the message reads. You literally need to have a method/var named application for WSGI to be happy. Note that mod_wsgi requires that the...
Read more

Timidity Mac Brew

Timidity: Download TiMidity++ GUI from here Download instruments, and install. touch /usr/local/share/timidity/timidity.cfg
Read more

Django Update Admin App Labels

Django: Customize app labels. If you want to change the label displayed in the admin CMS, and do a quick google, the questions seem to get rather bizard questions. Like, override templatetags, etc. The hard way python The easy way Use django's...
Read more

Django Admin Override User Panel

Remove Permissions panel from Django user admin panel. Sometimes it can be a little bit tricky to figure out how to customize your django admin setup. I had one very specific task: Remove the Permissions panel from the Django user admin panel. The...
Read more

Note to Self Python Unpack Kwargs Into Attributes

Note to self Python: Unpack **kwargs into properties I'm lazy. I want to be able to take any named arguments in my constructor call and make properties. Instead of doing this:
Read more

Python Get vs Getattr vs Getattribute

Python: get vs getattr vs getattribute __getattr__ is [only] invoked if the attribute is not defined in the instance and it was not found. __getattribute__ is invoked before looking for the attribute in the object instance. It has precedence over...
Read more

Packer Vagrant Build Vm

Archive SRC repo git archive -o nuskin-cms.zip HEAD # PACKER_LOG=1 packer build --only=virtualbox CG-RAA-packer-virtualbox-testing-2.json vagrant box add whateveryouwantittobe packer_virtualbox_virtualbox.box
Read more

Python Love

Python and love. taken from here
Read more

Note to Self Django List Models App

Note to self Django: list all models in app: A quick snippet to list all models declared in a Django app.
Read more

Nodejs Express Multiple View Engines

Node.js: Multiple templating engines simultaneously in express. I will start by saying that I am not a big fan of haml or jade. While I understand why some developers might and do enjoy them I prefer something more moustachesque In the case you want...
Read more

Note to Self Python Glob

Note to self Count files in directory Count files in directory
Read more

Note to Self Python Merge Dicts

Note to self #
Read more

Note to Self Speed up Terminal Open

Note to self Mac OS speed up terminal open window .hushlogin manual page http://apple.stackexchange.com/questions/41743/how-do-i-speed-up-new-terminal-tab-loading-time/54167#54167
Read more

Note to Self Terminal Find Files by Size

Note to self Find all files that have a size >= 100MB
Read more

Macosx Delete All Files Terminal

Note to self So, I needed to delete all pyc files from a project. Found a quick find option that would do just that: For a second I thought to make an alias but as it turns out, there is a built int tool in Mac that does the same.
Read more

Mac Create Local Development Domain

Note to self Create local development site: Add entry to Apache vhosts file: Restart Apache: Edit hosts file: Create symbolic link: Flush DNS cache: The DNS request for that domain may already be cached. To clear the cached entry, run this...
Read more

Django Management Command Dumpdb

Django management command: dumpdb Simple command to dump database content into a file, and upload it to an S3 bucket. GIST REF: https://gist.github.com/goliatone/6627702
Read more

Git Current Branch Multiple Upstream Refusing Push

Note to self If you get the following git error Solve it with:
Read more

Travis Permission Denied Bash Script

Note to self Running a travis build script, if you get an error like the following: The solution is to chmod the bash script in your travis file:
Read more

Python Terminal Progress Bar

Python: How to make a progress bar in terminal.
Read more

Objectivec Dynamicurl Gatewayservice

https://gist.github.com/goliatone/6616995
Read more

Python Unicodeencodeerror

Note to self PYthon: UnicodeEncodeError It might be as simple as using the encode(utf-8) method on your string.
Read more

Git Extending with Custom Commands

Extending git with custom commands. Aliases, would be one way to extend git. You can do things like: To define the alias, you can do it from the terminal: Which would create the following entry in your .gitconfig file Show git alias As an example...
Read more

Python Django Nginx Gunicorn

Django code not updated after source update. Jenkins, after code update, we need to restart gunicorn. When the code is updated, there’s no need to restart nginx; instead, gunicorn is restarted (not so prettily) with: kill -HUP
Read more

Python Django South Auto Error Table Alrady Exists

South, migrations out of order If you crate a migration and when you run it you get the following error or similar: Also, if you are getting this error when running tests, you might as well just disable migrations when you run the...
Read more

A Form and an Afternoon

Quote It's only a form and an afternoon. Boudreaux's razor.
Read more

Python Django Create User Mangement Command

Create user command. If you need to deploy a django application using Pupet or a similar deployment framework, this might be useful.
Read more

Javascript Prototype Shared Data

Consider the following: This seems to work well. The issue becomes apparent in the following example:
Read more

Python Django Create Global Management Command

To create a global command: TODO: Create gist. NOTE: Have a core app to store global commands and, generally speaking, things not tied to any...
Read more

Django Alreadyregistered Admin Error

Make sure you are not importing the same models in two different admin.py files. IE, if you do a copy and paste, remember to update your app name!
Read more

Javascript Callback Hell

Callback hell So, one of the biggest rants people have about JS, node specifically, is the so denominated callback hell. You know where code marches to the right faster than it moves forward. The Piramid of Doom? Common, I'm sure you know what I'm...
Read more

Testing

Something that is always appropriate, regardless of general style, is when you get a bug report. ALWAYS create a test case first & run your tests. Make sure it demonstrates the failure, THEN go fix the bug. If your fix is correct, that new test...
Read more

Egos on the Net Xxx

Egos on the net. How to avoid callback hell? Bruno Jouhier Re: [nodejs] Re: How to avoid callback hell? Try streamline.js. It is not a library but a language tool. Problem is solved and people should start to use real solutions instead of whining...
Read more

Python No Module Named

ImportError: No module named webapp.twiliohandler deployment try: from webapp.twiliohandler import TwilioHandler except:
Read more

Python Django Create Different Environments

set environment var http://stackoverflow.com/questions/15048963/alternative-to-the-deprecated-setup-environ-for-one-off-django-scripts production vs development...
Read more

Git Add Gitignore Boilerplate from Terminal

Note to self gibo is a handy shell script to use GitHub's gitignore templates. You can download it here.
Read more

Python Regex Expand

Pythonic. There is definitively some things I love about python.
Read more

Nano Set Tab to Spaces 4

Note to self I use nano to do quick edits or test out ideas in a dirty and quick script. If you use python, it's a good idea to have proper indentaion. Nano has a default tab size of 8. Edit ~/.nanorc: If you have a file and want to conver tabs to...
Read more

Enable Port Ip

Note to self To enable a port on the server, use the internal ip of 0.0.0.0 instead of localhost/127.0.01
Read more

Download Contents of Url Recursively

Self note More than once, I had the need to do a massive download of files from a URL. Quick wget command, options are pretty self explanatory:
Read more

Bash Override Built in Methods

Bash, override built in method It turns out you can override a built in method, quite simple actually. If you add the following to your ~/.bash_profile it will always be in effect for interactive shells. To find the current cd definition: rvm...
Read more

Add Syntax Support to Nano

PHP Get themes You can download themes from here Then, with this Now, if you want to add syntax highlighting.
Read more

Update Nano Mac Os

How to update nano on mac homebrew-dupes: These formulae duplicate software provided by OS X, though may provide more recent or bugfix versions. To install:
Read more

Sublime Text Show Hidden Files Gui

To show hidden files on the OS open dialog:
Read more

Make Git Love Terminal

Note to self Again, a quick one just to remind my self... List of backslash scaped special character: \a : an ASCII bell character (07) \d : the date in "Weekday Month Date" format (e.g., "Sat Aug 31") \D{format} : the format is passed to...
Read more

Git Autocomplete

http://richardhulse.blogspot.com/2008/06/using-git.html To enable git autocomplete in terminal: Then, add the following to .bashrc or .bash_profile local and remote branch names local and remote tag names .git/remotes file names git...
Read more

Profiling Anonymous Functions

Anonymous functions are not easy to profile because they inherently don't have a name under which they could show up in the profiler. There are two ways to work around this: rewrite to: It is not commonly known that JavaScript supports naming...
Read more

Sublime Command Line

Sublime terminal MacOS To make Sublime Text available from the command line, just create a symbolic link to the app's subl command.
Read more

Update Grunt Karma

Grunt Karma update. If you update to karma 0.5.0 and get the following error: Config file must export a function! Basically, you need to replace your old karma.conf.js file with the new format.
Read more

Python Xrange

Python xrange In python, using the range function actually creates a list which it stores in memory. However, using xrange just iterates through the numbers. range(0,5000) takes up more memory than xrange(0,5000) Here is a quick example of what I...
Read more

Javascript Strict Mode

//////////////////// Take a look, maybe we can use jsfiddle to embed tests? http://doc.jsfiddle.net/use/embedding.html //////////////////// http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/ I am sure you have...
Read more

S3cmd Backup

http://s3tools.org/s3cmd-sync
Read more

Rsync Backup

Remote backups with rsync (MacOS => Ubuntu) http://www.dedoimedo.com/computers/rsync-guide.html http://www.evbackup.com/support-rsync-setup/ http://superuser.com/questions/286911/save-output-to-a-text-file-from-mac-terminal TODO: UPDATE EXAMPLE...
Read more

Nvm Node Version Manager

nvm is to node what rvm is to ruby. If you want to have multiple versions of Node installed in the same machine, then this is the way to go. To install on Mac: To list available versions, if you have brew installed, you can run: Then, you can...
Read more

Github Redirects Untar Bash

Github redirect, tar, release
Read more

Github Tar Redirect Bash

Github redirect, tar, release
Read more

Mysql 5 5 Now Bug

consider the following query: If you are running mysql solution:
Read more

Ubuntu Update Ip

change ip ubuntu https://help.ubuntu.com/10.04/serverguide/network-configuration.html http://www.jonathanmoeller.com/screed/?p=2961 sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0
Read more

Egos on the Net Xx

Egos on the Net Python list Steven D'Aprano On Mon, 07 Jan 2013 18:35:20 +0800, iMath wrote: what’s the difference between socket.send() and socket.sendall() ? Please re-send your question as text, instead of as HTML (so-called "rich...
Read more

Installing Bundle Mysql

installing bundle mysql fails in ubuntu http://stackoverflow.com/questions/8874513/installing-mysql2-gem-for-ruby-on-rails-3-1-0 An error occured while installing mysql2 (0.3.13), and Bundler cannot continue. Make sure that gem install mysql2 -v...
Read more

Installing S3cmd Gpg

when you install s3cmd tools, you get a prompt that ask for gpg program. if you run which gpg in another terminal and you get nothing, follow: http://www.gpgtools.org/installer/index.html then, if you run which gpg again, you should get something...
Read more

Localpacketsniffingdebugtraffic

Troubleshooting You can see the raw values received by pystatsd by packet sniffing: You can see the raw values dispatched to carbon by packet sniffing:
Read more

Stuff

My self-summary I... have lived 12 years in barcelona. loose things and find things... I mostly find things. Two soccer goals and one basketball ring have fallen on my head. have never broken a bone. grew up in a island. have a deficit of 20,000...
Read more

Composer Import Old Libs

Let's say that you need to use an old library that is no longer mantained or simply not using composer. So, composer provides an autoloader. It handles 3 types of methods, PSR-0, classmap, and files. In your composer.json file, you can define a...
Read more

Neo4j Install

INstall: To enable node_auto_index: Add the following to the neo4j.properties file /usr/local/Cellar/neo4j/community-1.9.1-unix/libexec/conf/neo4j.properties Modify and uncomment Create the auto index for nodes, go to shel neo4j-sh (0)$ index...
Read more

Node Php

http://blog.revathskumar.com/2013/04/using-yeoman-with-php.html Mac, php, node, grunt ::) Middleware to handle php Add middleware call to livereload in connect options: To the watch task config options, add the php extension to the...
Read more

Serve Git from Local Computer Ip

Serve git from local computer IP http://stackoverflow.com/questions/15670692/git-equivalent-of-hg-serve For just browsing files and revisions git instaweb is the right solution. In addition if you want to set-up an ad-hock git server for sharing work...
Read more

Between the Idea

Between the idea And the reality Between the motion And the act Falls the Shadow
Read more

Qp Php Email Subject Encoding

http://en.wikipedia.org/wiki/Quoted-printable http://stackoverflow.com/a/4389755/125083 quoted printable decode http://php.net/manual/en/function.quoted-printable-encode.php Not...
Read more

Do Not Outsmart Your Customers

Do not outsmart your customers. So, I was in Nice, France, and went to this restaurant. I look over the menu and decided on a nice filet mignon. I ordered it well done, to the dismai of the waiter who did not hessitate to tell me that
Read more

Nultibytestrings

htmlspecialchars(): Invalid multibyte sequence in argument mb_string instead of trim
Read more

Passion

http://www.brainpickings.org/index.php/2012/02/27/purpose-work-love/ Work is what we do by the hour. It begins and, if possible, we do it for money. Welding car bodies on an assembly line is work; washing dishes, computing taxes, walking the rounds...
Read more

Pulling Ropes

Building software always starts with a problem. If we make an analogy and think of this problem as a rock that needs to be transported, then we can depict the following history. To move a rock, you can throw it or if its too big to grip you can push...
Read more

Chaos

life is a mess, emotions, chaos, entropy. A flow of accumulative stream of random emotions. Disconnected and unitary. But also, full of potential, endless combinations, infinite ways of threading reality. cosmological view of emotions. Emotions as...
Read more

Headlines

Don't be a 'Hammer', be water my friend. If a hammer is the only tool you have, then you will identify all problems as nails. Water, path of least resistence. Before you DRY, you should be WET. Don Repeat Yourself = Write Everyting Trice Do not...
Read more

Process

If every sprint fails but the product is stellar, was scrum working or failing? I'd argue working. My initial conclusion: success. If a process is a series of steps taken to achieve an end, a stelar product is fulfilling the goal. I think the...
Read more

Soccer

As long as I can remember there has been a bar debate about soccer and two of its main conflicting phylosofies. Resultadism vs Stylism. Resultadism values the direct result, sacrificing the means to achieve its result. Victory. Stylism values how...
Read more

Project: Open Luxury Days

After a short but intense development cycle, here it is: www.openluxurydays.com For this project I used the Kohana libraries I've released as open source on github. Every project is a good chance to keep them sharp and find/squish bugs. More soon...
Read more

CSS: Gradient borders

Just a quick snippet to make linear gradient borders.
Read more

Php Phpunit Windows Setup

Error windows phpunit could not open input file . pear phpunit2 textui testrunner.php To install PHP et al under windows, I used xampp. To fix this error, I had to edit phpunit.bat and update the paths to the php.exeand to the *PEAR directory. Also...
Read more

Ror Autotest Error Windows

I get this error when trying to run autotest-standalone- The following stacktrace : C:/Ruby/lib/ruby/gems/1.8/gems/autotest-standalone-4.5.2/lib/unit_diff.rb:77:in write': Invalid argument (Errno::EINVAL) Solution, replaced putc of lib/autotest.rb @...
Read more

Red5 Install as Daemon on Ubuntu

sudo useradd _red5 #create user that will run the red5-server daemon. sudo nano /etc/init.d/red5-server #create the sh script. paste contents ::from:: sudo chmod a+x /ect/init.d/red5-server #make it executable sudo update-rc.d red5-server defaults...
Read more

Kohana: php CLI

In windows, you need to set up your environment variables to execute php conformable from your command line. You can follow the instructions provided by the PHP manual, which is pretty clear. One thing to remember is that your PATH variable needs to...
Read more

Htaccess Directory

I need to make all content under a certain directory with one exception. There is one directory that has to be accessible through the browser. The layout could be something like this: backend/ |-admin |-system |-themes |-uploads You can deny all...
Read more

As3 Google Url Shortening Utility

Recently I needed to use a URL shortening service. I decided to go with Google's goo.gl I made a simple utility class to make use of the service. It will shorten any URL you or expand a previously shortened URL. It also features a simple cache...
Read more

Java Ant Build Error

Error: C:...\build.xml:21: java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 51.0 The 'Unsupported major.minor version 51.0' means somewhere code was compiled for a version of the JDK, and that...
Read more

Jangaroo Compiling Flashpunk Port

FlashPunk lib: mvn install Flashpunk tutorial mvn package
Read more

AS3: Keep your UI's DRY

Consider the following code snippet. Real world code, a form with multiple icons: //contactIconBtn var contactIconBtn:Sprite = _skin.getAssetAs("contactIconBtn", Sprite, null ); _contactIconBtn = new OSIconButton(contactIconBtn); ...
Read more

Apache not booting on windows

Quick note. If apache is missbehaving on windows, and does not boot make sure that skype is not configured to run on port 80.
Read more

As3 Error 1069

http://www.codebelt.com/actionscript-3/as3-onbwdone-error-flash-media-server-with-amazon-cloudfront/ Error #1069 _netConnection.client = new NetConnectionClient; package com.skinnygeek.media.video { import com.skinnygeek.logging.Logger; } Also...
Read more

Ruby Rubyscript2exe Error

http://mentedolulu.blogspot.com/2009/07/bug-rubyscript2exe-rubyscript2exerb621i.html ruby rubyscript2exe.rb helloworld.rb rubyscript2exe.rb:621:in replace': can't modify frozen string (TypeError) from rubyscript2exe.rb:621 from...
Read more

IE: Page renders, then 404

The issue: Page loads in IE but after it's completely rendered, it goes 404. This is exactly what was happening recently to this site. It was working as expected locally but once deployed to Heroku, every page went 404 on IE. It turns out that the...
Read more

Ubuntu Install Ssl Certificate

http://library.linode.com/web-servers/apache/ssl-guides/ubuntu-10.04-lucid
Read more

Toto: URL Rewriting

There is one entry on toto's github wiki which explains how to set up a redirect: If I include this on my config.ru the app crashes. Lookin at the logs, i can see something like: The solution is quite simple actually. Just update the version in...
Read more

Ubuntu Install Phpmyadmin

http://library.linode.com/databases/mysql/phpmyadmin-ubuntu-10.10-maverick apt-get update apt-get upgrade --show-upgraded phpMyAdmin requires the mcrypt PHP module apt-get install php5-mcrypt /etc/init.d/apache2 restart Installing phpMyAdmin apt-get...
Read more

Java Home Java Path

java home: C:\DEV\JAVA\32\jre6;C:\DEV\JAVA\jdk1.6.0_26 java path: C:\DEV\JAVA\32\jre6 C:\Program Files (x86)\ActiveState Komodo Edit 6\;C:\Program Files (x86)\NVIDIA...
Read more

Ruby Redcloth Error Markdown Hml

windows ruby install textile How to install RedCloth on Windows? NEST error => using haml: Haml::Error at /examples/using-haml Can't run Textile filter; required file 'redcloth' not found file: (TEMPLATE) location: nil line: 39 NESTA...
Read more

CSS: Decimal values in Chrome

It seems like Chrome does not render decimals for pixel values. The following works in FF and IE but not in Chrome: letter-spacing: -0.5px; However, the following does work as expected: letter-spacing: -1px; Also, it seems like it wont go...
Read more

Installing Toto in Heroku

Deploying toto in Heroku has been a breeze. I decided to go with toto for it's simplicity. In terms of code is really manageable, I think the main class might have around 350 lines of code- it is build on top of Rack with takes does much of the...
Read more

Hello Toto

So, everybody wants to be cool. Right? Nowadays cool kids either grow a french mustache, wear thick framed glasses, or code in Ruby. I decided to go with option number 3 and learn Ruby. I had exposure to the language, mainly through Project Sprouts...
Read more

Mxmclerror

http://jase21.blogspot.com/2010/07/mxmlc-error-loading-dprogram.html mxmlc Error Loading: "D:\Program Files\Java\jre6\bin\server\jvm.dll" mxmlc which is the flex compiler requires that you have Java Runtime Environment installed in you system which...
Read more

Kohana Config, lesson learned

The way you access configuration options in Kohana is through the Kohana::config('config-file.parameter-name') method and you screw the parameter name and request something that is undefined things go hire wire, nuts, crazy, loco. For...
Read more

Kohana PHP Error

Installing a Kohana application is pretty straight forward. There is a php install script that verifies the environment to make sure all goes smoothly once up and running. You have to make sure the application/cache and application/logs directories...
Read more

Koaha Git Project Setup

we will be using unffudle. create project local, follow instructions at: Introduction Git is a distributed version control system, originally developed by Linus Torvalds for Linux kernel development. It has grown over the years to serve as the...
Read more

Flex AS3 AMFPHP encoding issues

I'm working on a project that uses AMFPHP and that has two clients; a Flex AIR back-end client, and a Flash front-end client. Im experiencing issues with class mapping from AMFPHP to AS3 on the Flex client only, getting the following error: The flash...
Read more

Load JavaScript libraries from Flash

If we have the need to load a javascript library from our flash application, we can use this class. We can use this JSLibraryLoader as an example of what we can do if we build on top of a simple class taking care of one specific concern. We are going...
Read more

AS3: StringTemplate class

A simple class can many times be a powerful tool to build more complex stuff on top. By simple a mean that has few or one concern, and takes care of an initially uninteresting task. The StringTemplate might be an example of that. What it does is...
Read more

Mxmcl Error

Just formatted my box and while doing a fresh install of FlashDevelop, I kept getting this error: mxmlc Error Loading: "D:\Program Files\Java\jre6\bin\server\jvm.dll" The flex compiler (mxmlc) requires that you have the JRE installed in your...
Read more

MySQL SSH tunnel with putty

Just a quick note to an article on linode's library that explains how to make a mysql tunnel on Windows with putty. Just remember that while you have the tunnel open all calls to localhost will get..well, tunneled, meaning that you will not be able...
Read more

Ubuntu SFTP jails setup review

After setting up a SFTP only chroot jail I had to log with Filezilla and got error: Error: Server unexpectedly closed network connection Error: Unable to connect to server The set up was working previously so I had no idea what was...
Read more

Ubuntu SFTP jails setup

Quick note on how to limit user's access with SFTP Jails on Ubuntu. Access the ssh config file nano /etc/ssh/sshd_config Modify so that it contains the line Add the following block to the end of the file: Match group filetransfer ...
Read more

title: " Ds Store" date: 2015-11-13 template:...
Read more

title: "Travis Node Karma Build Error" date: 2014-04-29 template: "post.hbs" List of karma build erorrs: One thing that is frustrating, and recurrent engouh; karma build errors on travis. files not found: If karma does not find your files, it will...
Read more

title: "Karma Travis Debug Warnings" date: 2014-03-15 template: "post.hbs" Karma, dependency hell. I have a few projects running continuous integration with travis-ci After updating one of my projects to a newer version of karma, the builds in travis...
Read more