Parent-Scoped mixins Sass

I recently had a need to build a Sass mixin that didn’t produce its output inside of its heirarchy. It’s easy, but wasn’t obvious in the documentation:

Typically I do my mixins like this:

@mixin scale($val) {
	-webkit-transform: scale($val);
	-moz-transform: scale($val);
	-ms-transform: scale($val);
	-o-transform: scale($val);
	transform: scale($val);
.btn {
	@include scale(0.5);

Which, when you use it produces output like this:

.btn {
	-webkit-transform: scale(0.5);
	-moz-transform: scale(0.5);
	-ms-transform: scale(0.5);
	-o-transform: scale(0.5);
	transform: scale(0.5);

My need was a page-wide change. If the body tag had a specific selector, I needed particular children to have different styles. Here’s how it’s done:

@mixin foreign-button($val) {
	body.russian & {
	background-image: url('russian/'+$val);
	body.spanish & {
		background-image: url('spanish/'+$val);
.btn {
	@include foreign-button('path/to/image.png');

The output of this method looks like this:

body.russian .btn {
	background-image: url('russian/path/to/image.png');
body.spanish .btn {
	background-image: url('spanish/path/to/image.png');

The key is the placement of the & character. It’s an indicator to sass of where you’d like to put your heirarchical selector, in this case, .btn

DigitalOcean is Perfect for My Needs

I’ve been working on for a while now, and I needed somewhere to host it. My friend Steve recommended and the setup process was super simple.

They charge about 5$ a month for a decent server setup with easy upgrading.

I was also able to spin up a number of temporary servers to play with as well as duplicate servers for continuous integration, staging, etc.

All in all, they seem to be a fantastic company and well worth the money. If you know how to administer a Linux box, they’re a great choice.

But your kids have more to gain

The Bard Debate Union was founded in 2004; in addition to hosting a robust public debate series and sponsoring a number of community based outreach projects, the team competes nationally in the British Parliamentary Debate Format. Professor Ruth Zisman of the Bard Philosophy Department, one of the co founders of the team, directs the program together with David Register, Faculty member of the Bard Learning Commons and Faculty Fellow in the Bard Prison Initiative. The highly decorated, award winning Bard Debate Union is also proud to be integrating debate training and education into the innovative and world renown Bard Prison Initiative a program through which incarcerated individuals across 6 New York State prisons enroll full time in coursework and earn degrees from Bard College.

replica oakleys Legislation, because I think very often these things come back years and years and years later,” said Kinney. “I think the church needs to do everything it can to stand on the side of victims, and certainly that would be one way of addressing the issue. Standing on the side of victims that is, and not lawyers.”. replica oakleys

cheap oakley sunglasses “The case has been amicably resolved and will be dismissed,” said Thomas Carlock, an attorney representing Lewis. A suit filed by the family of the other victim in the fight was settled previously. Terms were not disclosed. Guys ride him, especially ex players. When you got a history, when you can go and google your history, you need to be a little careful with what you say. Sometimes when guys get on a microphone in front of their face they just talk and talk and talk and forget about their history. cheap oakley sunglasses

fake oakley sunglasses “At The North Face our mission is to inspire a global movement of outdoor exploration,” said Todd Spaletto, President, The North Face. “By tapping into the power of IBM’s Watson, we can ensure our customers get the best jacket for the activities they love cheap oakleys, whether that’s ice climbing in Montana or skiing in Vermont. This not only improves their online shopping experience, it ultimately maximizes their outdoor experience.”. fake oakley sunglasses

replica oakley sunglasses Sport: Track and fieldAthletic accomplishment:Cannistraci continued his unbeaten streak in the shot put on Feb. 26 at the Dream Big Invitational by thowing 56 feet, 10.5 inches, setting a meet record. He’s ranked No. But your kids have more to gain. A dad who can support himself and contribute to a healthy co parenting plan. And a mom who’s willing to stretch, in the “best interest of the kids” to give that same dad some additional time and rights so that he can show up in the best way replica oakley sunglasses.

Linux Frustrations

Ahhhh Linux, those who use you, claim to love you, but I propose they’re all just trying to sound superior.

I use Linux. I can’t stand it. I often joke that OSX takes one extra step compared to Windows. Want to move the window to the right side on Win 7? Drag it all the way to the right and it sticks 50% right. Want to do this in OSX? drag it till it’s about 50%, then resize it. Sure, can do it, but it’s one extra step. Comparatively, doing anything in Linux requires that you try it, fail, read a manual, take 5 extra steps AND pray. And even then, you don’t get the same result as everyone else. Linux flavors are as varied as grains of sand on the beach, and so, anything I post here will probably fall on blind ears unless you happen to be in the same place I was when I started. My apologies, I wish I had time to spin up a VM for every flavor of Linux to perform my explanations, but alas, I’d rather be coding. =D

Installing the Sun JDK in Ubuntu Linux

All I wanted was the Sun JDK on the new, shiny Ubuntu I spun up in VMWare. Eclipse (among other things) recommends you do this for performance reasons. So, I tried. I looked through the apt-get system, nothing. I looked at sun’s website and was greeted with a plethora of errors when I got the rpm, installed rpm using apt-get and then tried to rpm -ivh the package.
this is what my error partially looked like:

Failed dependencies:
	/bin/basename is needed by jdk-2000:1.7.0-fcs.i586
	/bin/cat is needed by jdk-2000:1.7.0-fcs.i586
	/bin/cp is needed by jdk-2000:1.7.0-fcs.i586
	/bin/gawk is needed by jdk-2000:1.7.0-fcs.i586
	/bin/grep is needed by jdk-2000:1.7.0-fcs.i586

the final solution was on and went as so (I would have linked, but it was tough to notice that you had to do 3 steps and not just two–keepin it simple):

apt-repository "deb lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

Why use Math.random? Use a Date instead

I’ve always wondered about this. Cache busting is a common need in my field, and I always see people doing something like the following:

Math.floor( Math.random() * 1000000 );

this will produce something like 809959 and *should* be different every time. If all you’re looking for is a unique number, why not use the Unix timestamp? When it comes to cache busting, if the same user is able to reload the same asset twice in the same millisecond, I say they deserve to get weird results.
That said, it’s not technically random, and it’s possible for your code to produce recurrences in the same millisecond, so use it wisely.

new Date().getTime()


new Date().time()



PHP and SSH and SCP – exec, backtics, popen, or proc_open

I can SSH into a server using an ssh key I was given. It’s pretty simple, I just open a terminal and type in

ssh -i key.ssh cms

and then it opens up like it’s a local box. I can mkdir, rm, and cp all I want. The problem is, what if I want to do similar functionality in PHP? There’s at least 4 ways to execute a command, but while some of them will work for some things, I’ve only succeeded in calling ssh one way. Here’s what I’ve learned.
Using backtics seems like the simplest solution and seems to work fine.

$scp = "scp -i key.ssh";
$scp .= " ";
$scp .= "";
$scp_exec = `$scp`;

using ` around your command causes it to execute.

There’s only one way I’ve actually succeeded in running SSH commands on my server. There’s plenty of blog posts out there about how you might do it, but ultimately, they’re vague or incomplete. I hope this helps someone.

//build the array that indicates which part of the call does what
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read
1 => array("pipe", "w"), // stdout is a pipe that the child will write
2 => array("pipe", "w") // stderr is a pipe that the child will write
$mkdir = "ssh -i key.ssh 'mkdir -v www/export/newfolder'"';
$mkdir_handler = proc_open($mkdir, $descriptorspec, $pipes);
$mkdir_write = stream_get_contents($pipes[1]);
$mkdir_result = "mkdir result: \n" . $pipes[1];

As far as I know, the ssh call is only executed when stream_get_contents is called. The result of this call is placed into the pipes array in the 1th item. Don’t forget to close your session!

Getting Named Parameters for a Component in Flash using JSFL

When working with components, using JSFL, you can get access to the selected Component using


If your component has parameters, you should be able to access each parameter’s name attribute, but for some reason, there’s a bug in Flash. You can still get the parameters, but it takes a little doing.
The following script will return an array of parameters for the selected component.

var attribs:Array = MMExecute("var a = [];" +
	"for(var i  in fl.getDocumentDOM().selection[0].parameters){" +
	"	a.push(i);" +
	"}" +

How does it work?
When you use the for…in feature on the parameters array, it returns double the results that it should, given the length attribute. For example, if you were to say

for(var i = 0; i< fl.getDocumentDOM().selection[0].parameters.length; i++)

you might get 11 results, whereas with this:

for(var i  in fl.getDocumentDOM().selection[0].parameters)

you'd get 22, the same results, followed by a list of names. It's as though there's another named value array tacked on to the results of the I've used this to produce a double length array, which I then chop off half and return a joined String.
We then parse this string back into an array and can move through it.

Creating a swc from Flex

I spent a bit of time looking for a decent answer to this and only found it halfway in a video. Here we go:
To make a swc from a flex file

  1. Prepare your files
  2. Make a new Flex Library Project with the name you desire for your swc
  3. Copy your files into the src directory, maintaining directory structure where applicable
  4. In the Flex Library Build Path settings for the Library Project select the src directory
  5. Right click the project and select “Build Project”

Your swc will appear in the bin directory.