- There are some situations that are difficult to distinguish mechanically, so I now consider all of those cases problematic, even when they are not obviously wrong.
- You should be coding for readability and error resistance.
- The place to express yourself in programming is in the quality of your ideas, and the efficiency of execution. The role of style is the same as in literature. A great writer doesn't express himself by putting the spaces before his commas instead of after, or by putting extra spaces inside his parentheses.
- Many people think they have good reasons for doing things badly.
- [The purpose of JSLint is not to make you feel good about inadequate coding standards.](http://tech.groups.y
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'haml' | |
require 'koala' | |
enable :sessions | |
set :facebook, {:app_id => 'Application ID', | |
:app_secret => 'Application Secret', | |
:callback_url => 'http://localhost:3000/canvas/'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class InternationalizationEx | |
{ | |
public static void main(String[] args) | |
{ | |
String lang, country; | |
Locale cLocale; | |
ResourceBundle msg; | |
lang = new String("de"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo ifconfig en1 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Examples: | |
# client = FGraph.new("USERNAME") | |
# | |
# if you need see response details use: | |
# client.request # returns a Net::HTTPFound instance, with this you can see the status, headers# Examples: | |
# client = FGraph.new("USERNAME") | |
# | |
# client.data # returns the parsed response body | |
# if you need an alias to get the api data response, use: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some good references are: | |
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
#1. Install PostgreSQL postgis and postgres | |
brew install postgis | |
initdb /usr/local/var/postgres | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate a module which imports a given subset of module methods | |
# into the including module or class. | |
def Methods(source_module, *method_names) | |
all_methods = source_module.instance_methods + | |
source_module.private_instance_methods | |
unwanted_methods = all_methods - method_names | |
import_module = source_module.clone | |
import_module.module_eval do | |
define_singleton_method(:to_s) do | |
"ImportedMethods(#{source_module}: #{method_names.join(', ')})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin, random, string, re | |
class AnonymiseCommand(sublime_plugin.TextCommand): | |
def replacement(self, s): | |
# Figure out which chars to use | |
chars = [] | |
if re.search("[a-z]", s): | |
chars += string.ascii_lowercase | |
if re.search("[A-Z]", s): |
I had some headaches yesterday while trying to upgrade to VMWare Fusion with Vagrant.
The steps that work are:
- export your boxes from Virtualbox to OVA files
- run 'vagrant destroy' on all your boxes
- uninstall Virtualbox using the uninstaller script in the installer DMG
- download VMWare Fusion
- run 'vagrant plugin install vagrant-vmware-fusion' to install the provider plugin
- run 'vagrant plugin license vagrant-vmware-fusion license.lic' to install the license you just bought
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var script, | |
scripts = document.getElementsByTagName('script')[0]; | |
function load(url) { | |
script = document.createElement('script'); | |
script.async = true; | |
script.src = url; | |
scripts.parentNode.insertBefore(script, scripts); |
OlderNewer