Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
class Float | |
def round_down n=0 | |
s = self.to_s | |
l = s.index('.') + 1 + n | |
s.length <= l ? self : s[0,l].to_f | |
end | |
end | |
# 2nd variant | |
class Float |
# Rake task to launch multiple Resque workers in development/production with simple management included | |
require 'resque/tasks' # Require Resque tasks | |
namespace :workers do | |
# = $ rake workers:start | |
# | |
# Launch multiple Resque workers with the Rails environment loaded, | |
# so they have access to your models, etc. |
desc "Set the magic encoding comment everywhere to UTF-8" | |
task :source_encoding do | |
shebang = '\s*#!.*?(\n|\r\n)' | |
magic_regex = /\A(#{shebang})?\s*(#\W*(en)?coding:.*?$)/mi | |
magic_comment = '#-- encoding: UTF-8' | |
(Dir['script/**/**'] + Dir['**/**{.rb,.rake}']).each do |file_name| | |
next unless File.file?(file_name) |
// http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object | |
//ecma 5+ | |
Object.keys({}).length; // 0 | |
// pre ecma 5 | |
function isEmpty(obj) { | |
for(var prop in obj) { | |
if(obj.hasOwnProperty(prop)) | |
return false; |
require 'active_support/core_ext/hash/conversions' | |
require 'action_dispatch/http/request' | |
require 'active_support/core_ext/hash/indifferent_access' | |
class Turbine | |
def initialize(app) | |
@app = app | |
end |
// module dependencies | |
var http = require('http'), | |
url = require('url'); | |
/** | |
* UrlReq - Wraps the http.request function making it nice for unit testing APIs. | |
* | |
* @param {string} reqUrl The required url in any form | |
* @param {object} options An options object (this is optional) |
require 'sinatra' | |
require 'redis' | |
require 'json' | |
require 'date' | |
class String | |
def &(str) | |
result = '' | |
result.force_encoding("BINARY") |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |