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
{ | |
"caret_style": "smooth", | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"file_exclude_patterns": | |
[ | |
".DS_Store", | |
".gitkeep", | |
"*.css" | |
], |
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
{ | |
"caret_style": "smooth", | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"file_exclude_patterns": | |
[ | |
".DS_Store", | |
".gitkeep" | |
], | |
"folder_exclude_patterns": | |
[ |
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
<?php | |
# File to load | |
$file = curl_init('http://dl.dropbox.com/u/YOUR-ID/location.txt'); | |
curl_setopt($file,CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'); | |
$html = curl_exec($file); | |
return $html; | |
?> |
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
<?php | |
$i=0; | |
while ($i<= 40) { | |
echo md5(rand(0,20000)) . "<br>"; | |
$i++; | |
} | |
?> |
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
<url> | |
<loc>http://yourdomain.com{{post.url}}/</loc> | |
<changefreq>weekly</changefreq> | |
<priority>0.80</priority> | |
</url> |
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 'sinatra' | |
require 'data_mapper' | |
require 'json' | |
# Authentication | |
# use Rack::Auth::Basic, "Restricted Area" do |username, password| | |
# username == 'admin' and password == 'admin' | |
# end | |
# set json as content type for all requests |
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
class String | |
# remove protocol, www, and trailing slash from URL string | |
def to_clean_url | |
u = self | |
if u.start_with?('http://www.') | |
u = u[11..-1] | |
elsif u.start_with?('https://www.') | |
u = u[12..-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
# run this in the terminal | |
# via http://ruby5.envylabs.com/episodes/419-episode-383-july-2-2013 | |
ruby -run -e httpd . -p 5000 |
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
# Checks status code of multiple URLs and prints them | |
require "mechanize" | |
urls = [ | |
'http://maxlielje.co' | |
] | |
@agent = Mechanize.new |
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
class Redcarpet::Render::HTML | |
def footnote_ref(number) | |
@article_id ||= [*('a'..'z'),*('0'..'9')].shuffle[0,4].join | |
fn_ref = "<sup id='fnref-#{@article_id}-#{number}'>" | |
fn_ref << "<a href='#fn-#{@article_id}-#{number}' rel='footnote'>" | |
fn_ref << "#{number}</a></sup>" | |
end | |
def footnote_def(content, number) |
OlderNewer