Text
There is a constant struggle we face when “naming things”.
It makes the most sense to order words as we do digits in our numbers (i.e. big-endian, most significant “digits” first). Unfortunately in the English language, adjectives conventionally precede nous (little-endian) and it causes a horrible yet prevalent tendency when writing code to name things such as “initialState” instead of “stateInitial”.
This is a huge problem. It may not seem significant at first, but it is.
Extrapolate for a second and imagine alphabetizing variables:
alphaState betaState deltaState gammaState
Now intermix them with other important information on the same logical level.
afterAuth alphaState authInfo beforeAuth betaState deleteEntity deltaState getEntity
Wow, it’s a total smorgasbord of names!
If we intelligently normalize our naming scheme, alphabetizing would make sense of our list of various “things”.
authAfter authBefore authInfo entityDelete entityGet stateAlpha stateBeta stateDelta
Not every language is like English in this way (e.g. Latin or Spanish), so I wonder if those languages bask in the luxury of never having such problems.
As a side note, there is the idea (from 1984, Tim Leary, and the like) that language informs our reality. I wonder if the little-endianness of our language has any butterfly-effect implications for how we prioritize an urgent task vs an important task.
0 notes
Text
Visit Blocked Websites on Mac for $10/mo
It's easy. It's called SSH tunneling. You will need:
A Mac with access to Terminal.app and proxy settings
A remote server with shell access, such as Linode.com ($10/month)
Basic understanding of command line
Open Terminal and run this command, substituting [email protected] for your Linode (or other) user & IP:
ssh -N -D 8080 user@host
This will open a port forwarding tunnel between your local machine and your remote server.
Next you need to open System Preferences (Network > Advanced > Proxies) or access the proxy settings on your web browser.
Set the proxy type to SOCKS. Set the address to 127.0.0.1 and the port to 8080. OK. Apply.
To verify this is working, try visiting whatismyip.com to see that you have your remote server's address.
If everything worked, you should be able to access any of the blocked sites from your network! Happy day!
1 note
·
View note
Text
Someone has made fake London Underground signs, and whoever did it is a ruddy genius.
http://imgur.com/a/lUWTG






























85K notes
·
View notes
Text
Duck Joke
So a duck walks into a bar and says, "Do you have any grapes?" The bartender says, "No, this is a bar, get lost." So the next day the duck comes back and asks, "Do you have any grapes?" The bartender said, "No, no grapes. It's not like we were just OUT of grapes when you asked yesterday, it's that we NEVER have grapes. Now get out of here." The duck comes back again and asks, "Do you have any grapes?" The bartender says, "Look, I'm getting sick and tired of this! The next time you come in hear asking for grapes, I'm gonna nail your frickin' bill to the counter, got it?!?" So the duck comes back the next day and asks, "Do you have any grapes?" The bartender slams the counter and screams, "That does it! I'm gonna nail your frickin' bill to the counter!" So he reaches down to pick up his hammer and his nail but when he gets back up he sees that he's staring straight down the barrel of a semi-automatic rifle that the duck is holding. He doesn't even have time to drop his jaw before the bullets start RIPPING through his body, shaking it like a marionette on heroin and spurting blood everywhere. And there's an off-duty cop in the bar, and he draws his piece, thinking he's gonna take the duck out, right? But the duck SEES him in the reflection of the mirror, okay? And he leaps off the barstool doing a spinning 180 and drops the cop with a single short blast. Then the duck jumps over the counter and walks past the bartender's bleeding body on the floor and opens the mini-fridge under the bar, and all the grapes start spilling out. And now the duck is pissed! He grabs a bunch of grapes and stuffs them in the bartender's mouth, then he swaps his rifle for a shotgun, and starts jamming the grapes in the bartender's mouth with the end of the gun, yelling, "No grapes?! No grapes, huh?!" [shotgun blast, stuff more grapes into mouth, another shotgun blast] And at this point this mother is crying while her baby is wailing at the top of his lungs, and the duck jumps on the counter and yells, "STOP SCREAMING! STOP SCREAMING!"
source
0 notes
Photo





Famous scientist names, illustrated, by Kapil Bhagat.
(via my newest love, Quipsologies)
5K notes
·
View notes
Text
Speed-up YouTube Buffering 2013 - Mac OS X Mountain Lion
Enter this line into Terminal, then enter your password:
sudo ipfw add 400 drop ip from any to 206.111.0.0/16
To undo what you just did:
sudo ipfw delete 400
Need I say more?
0 notes
Text
Irrefutable Truths of Art
1. It doesn't need to be original; it just needs to be good.
Nothing is entirely original. Take it from Carl Sagan, "If you wish to make an apple pie from scratch, you first must invent the universe."
Everything we "create" is really just a novel synthesis or rearrangement of anti-novelties. Don't fight this. It's a law of nature found even in the foundations of physics (the law of conservation of energy). It's implied in the words of exalted artists like Pablo Picasso, "Good artists borrow; great artists steal." If you stare deeply enough into a work of art, you will notice that it is comprised of things already known, things you may have already seen in some form. What's new is the arrangement and incorporation, the juxtaposition and harmony of harmonies of harmonies.
We need to use this to our advantage, as Sir Isaac Newton did, "If I have seen further, it is by standing on the shoulders of giants." We mustn't dabble and fiddle, we must steal as Pablo Picasso tells us. Own what you find. Use it! Make it yours. Synthesize.
This leads well into my next major truth of art.
2. Art is that which is perceived as art.
Art does not exist, in the traditional sense of existence. Much like the US dollar, or God, art's definition is founded solely on the faith of its believers. This truth is as scary as it is empowering. A truth that will set you free and help you improve as an artist.
Go ahead -- attempt to define art. It's a topic in philosophy. It's elusive. Holes can be poked through any definition of art. Artists are constantly challenging the definition. Contemporary art is full of strange works such as four minutes and thirty-three seconds of silence, urinals hanging on the wall, vertically rotating kitchens, piles of trash, silver balloons being let into the sky, etc.
It is not the molecules of the work who make it art. Art is made of color, rhythm, movement, expectation. It's made of perception. Art happens in you. Color is not out there. Color is your personal, internal interpretation of frequencies of reflected electromagnetic radiation.
You can perceive anything beautiful as art. Lift the boundaries. Make art by believing what you perceive is art! One man's trash is a beholder's art.
0 notes
Text
iOS 6 Safari caches HTTP POSTs
iPhone PhoneGap and Web developers beware! New iOS 6 Safari has gone cache-happy.
I first noticed this working on my new project, QHabits. On the iPhone, changes saved via AJAX POST requests were not 'sticking' after a refresh.
A little research turned up this stackoverflow post, which revealed the solution. The following header must be included in all HTTP POST responses from the server:
Cache-Control: no-cache
Astoundingly, changing the data included in the POST request will not help!!! Neither will other well-documented header combinations. Neither does jQuery's {cache:false} parameter for $.ajax(). I know, shocking.
Alternatively you can change the URL path by adding some unique junk data to the end. I don't recommend doing this but, if you must, here is an example. If you normal hit POST /entry/update/1, you can add a timestamp to the end as in POST /entry/update/1/1358381174. Note this must be in the path of the URL, not in the query parameters.
I solved the problem in Ruby's Sinatra framework with the following before filter:
before '*' do if env['REQUEST_METHOD'] == 'POST' headers 'Cache-Control' => 'no-cache' end end
You can do this in PHP like so:
<?php header('Cache-Control: no-cache'); ?>
Hope this helps someone.
0 notes
Photo
a suspicious case of recursion
Title: Case Zoom Artist: David Pakcer
68K notes
·
View notes
Audio
For our ears and our soles.
buy the ep on itunes, released today.
0 notes
Text
Deploy a Ruby Rack App on Debian
I chose to go with Linode.com as my host because while sexy managed systems like Heroku are very easy to get started with, there are plenty of annoying issues that arise after using them for a while and users lack the full control available when designing your own scalable system. You also aren't affected by all of EC2's downtime.
I'll have your app online in minutes.
Roll your own Debian instance and login as root. First we're going to update all the software repos and install some essentials
apt-get update apt-get install build-essential sudo git libssl-dev libpcre3-dev libcurl4-openssl-dev wget libopenssl-ruby libcurl4-openssl-dev libssl-dev zlib1g-dev libsqlite3-dev
Next, be sure to create an underprivileged bitch account to do all your dirty work. Substitute your own username for jchook.
adduser jchook usermod -aG sudo,staff jchook
Open a new terminal tab and log-in to your linode with your new user.
# Install RVM for managing ruby versions curl -L https://get.rvm.io | sudo bash -s stable rvm pkg install zlib --verify-downloads 1 rvm pkg install libyaml rvm install ruby 1.9.2 rvm install rubygems latest # You have to compile the ssl shit now for whatever reason cd /usr/local/rvm/src/ruby-1.9.2-p320/ext/openssl ruby extconf.rb make make install # Install some neat gems # add whatever gems your app depends upon now too gem install thin
Now login as root again (yes, re-login)
mkdir /srv/http cd /srv/http git clone gitserver.com/path/to/app.git cd app thin start --port 80 --daemonize thin install
Now hit your web server and revel in the simple beauty.
0 notes
Text
Should I Learn Ruby or PHP?
Ruby has a beautifully simple syntax. It is true OOP and has some truly excellent features, such as arbitrary precision arithmetic. Ruby is so elegant, in fact, that your main concern will be avoiding pompous erudite elitists that apply to work on the project.
PHP is fast. It has a thriving developer community. However, since it has many "features" like weak typing and superglobals, it attracts a lot of beginner-level programmers whose only coding experience is reading PHP for Dummies. You'll find the majority of bonafide computer scientists do not choose to write in PHP.
Let's have a history lesson. PHP now stands for Hypertext Pre-processor, but it was born as a handful of perl scripts called "Personal Homepage Tools". It was completely re-written twice before having major features sloppily jammed into the language. The object-oriented aspects of PHP were an afterthought, including sane error handling with try/catch blocks. Namespaces weren't even available until 5.3 and many developers are still very unhappy about the way it was implemented. In a word, PHP is a perfect example of "feature creep" that results in a generally icky syntax and plenty of bugs.
In contrast, Ruby was the result of a clear and beautiful vision, designed by *a* japanese supergenius. The same core he wrote back in 1997 still represents the bulk of the current language and is capable of everything PHP could muster (after years of *major* overhauls) and more.
PHP has many grammar shortcomings which reveal the clunkiness of its innards. For example, you cannot access an index of an array returned by a function without storing it in a variable. In Ruby this is completely possible (not that it should be done), which is a testament to the completeness of the language.
PHP cannot overload operators. PHP has no built-in regex object or syntax, so there is no easy way to distinguish between regular expressions and strings. PHP only recently added anonymous functions (which is just sad) so it allows strings and arrays to be "callable" (also sad).
PHP does provide a powerful reflection suite. However, you get most of this "for free" in Ruby with `Object::methods` and whatnot. PHP also has cool jam-ins like "Magic Methods" which serve to make code less straightforward and slow everything down. Ruby's design does not require such "features". PHP also has some features that end up necessitating workarounds & headaches for developers because they can be turned off, see Magic Quotes (yes PHP is very "Magical").
People used to argue that Ruby was too slow and not capable of true multithreaded processing, but this is all history since 1.9 uses native threads. Though it's still not as fast as PHP (and JFYI, PHP is really slow compared to any compiled languages like C/C++, D, Haskell, etc).
My recommendation is to use Ruby but avoid the rasinbrain conventions found in the RoR community (e.g. 2-spaces instead of tabs, connecting loosely coupled components via a myriad of data formats, installing 100,000 gems and dependencies for simple apps which make it extremely difficult to debug, using RoR and/or node.js, having holier than thou attitude, etc).
If you want a web framework to get you started, try Sinatra.
tl;dr?
Ruby
3 notes
·
View notes
Link
The authoritative source on Wes Roberts, a solutions-oriented designer who makes tools to help others accomplish goals.
0 notes
Text
PHP isset() vs. array_key_exists()
Summary: Do not use array_key_exists() or key_exists.
After some benchmarking, I realized that using isset() is 95% faster than array_key_exists() and key_exists().
Instead of array_key_exists($ra, $key);
Use isset($ra[$key]);
1 note
·
View note