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
/* * * | |
A simple bit of code that automatically prepends an AudioPlayer instance | |
(http://wpaudioplayer.com) before the paragraph of any link to an MP3. | |
Depends on jQuery and AudioPlayer. | |
* * */ | |
$(function() { |
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
# tl;dr | |
# grabs some tumblr posts from google and returns their word lengths! | |
# for nostrich! | |
require 'rubygems' | |
require 'open-uri' | |
require 'nokogiri' | |
require 'json' | |
lengths = [] |
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
# title_is_summary - does this RSS item REALLY have a title? | |
# see: tumblr photo posts | |
# | |
# title = (title of some RSS item) | |
# description = (description of the same item) | |
clean_title = title.strip.gsub(/\s+/, ' ').sub(/\.\.\.$/, '') | |
clean_description = description.gsub(/(<|<).+?(>|>)/, '').strip.gsub(/\s+/, ' ') | |
title_is_summary = clean_title == clean_description[0 .. clean_title.size - 1] |
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
# That apartment is nice but it's outside your "40 x rent" limit. | |
# How much more are you gonna have to pay? | |
# NOTE: I Am Not A Broker, I'm only *pretty* sure this is how it works, | |
# calculate at your own risk. | |
def security(rent, salary) | |
normal_security = rent * 2 | |
base_rent = salary / 40.0 | |
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
// that is, navigate to the direct URL for an image hosted on the world wide web, then >>>INVOKE<<< | |
// i wanted the bookmarklet to redirect to the new direct image URL but that was out of scope! | |
javascript:void(window.location="http://api.imgur.com/2/upload.json?url="+encodeURIComponent(window.location.href)); |
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
<!-- | |
a styled php version you can throw up on your apache | |
because i'm some kind of machinist | |
--> | |
<style> | |
/* oooh */ | |
html, body, ul, li { font-family: Verdana; font-size: 14px; line-height: 20px; } | |
body { width: 400px; margin: 20px auto; background: #333; } | |
ul { list-style: none; } | |
li { margin-bottom: 10px; color: #AAA; overflow: hidden; height: 20px; white-space: nowrap; text-overflow: ellipsis; } |
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
# from your working directory, just run `rackup /path/to/simple_server.ru` | |
require 'tilt' | |
require 'sass' | |
run lambda{ |env| | |
path = ENV['PWD'] + env['REQUEST_PATH'] | |
path += 'index' if path =~ %r[/$] | |
path.gsub! /\?(.+)$/, '' | |
params = $1 |
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
Array.prototype.slice.call(document.querySelectorAll("img[class*='avatar'], img[class*='profile']"), 0).forEach(function(e,i,a){ e.src = ("http://avatarpro.biz/avatar/" + encodeURIComponent(e.src.replace(/\//g, "-"))) }) |
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
ids = [329740082619772928, 329918487558504451, 330280700072833026, 330651260321669121, 331023740257325057, 331355726356291585, 331747132803518465, 332093606355664896, 332458504747110401, 332817496753184768, 333183149867667458, 333542218503696384, 333921623436574721, 334270156035469314, 334632030774099969, 335013040451891200, 335369313466871808, 335719753299685376, 336094052749565952, 336461902785966081, 336790999277916162, 337173236968210432, 337529860106878976, 337875782665912320, 338255438862766080, 338630809231708160, 338988045032370177, 339350345010536448, 339714371792035841, 340065176281837569, 340451705298771968] | |
ids.each do |id| | |
method = :post | |
uri = URI "https://api.twitter.com/1.1/favorites/create.json" | |
params = { id: id, include_entities: false } | |
request = Net::HTTP::Post.new uri.request_uri | |
request.set_form_data params | |
request['Authorization'] = SimpleOAuth::Header.new(method, uri, params, { | |
consumer_key: CONSUMER_KEY, |
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 'open-uri' | |
puts open('http://johnholdun.com/wardrobe/bible-doge.txt').read.split("\n").sample(1 + (rand * 2).round).shuffle.send((rand < 0.5 ? :unshift : :push), 'wow').join('. ') + '.' |
OlderNewer