Skip to content

Instantly share code, notes, and snippets.

@mildred
mildred / transform_layouts.rb
Created December 13, 2011 15:55
Jekyll plugin to have layouts transformed by Converters as well, taken from https://github.com/mojombo/jekyll/pull/351
module Jekyll
class Layout
alias old_initialize initialize
def initialize(*args)
old_initialize(*args)
self.transform
end
@flexgrip
flexgrip / dwh-polls.js
Created September 21, 2012 17:53
dwh-polls
{
votes: 21,
monitor: false,
success: true,
voters: 2,
start_time: 1348246303.613473,
polls: [
{
nonce: '8ec402a536549c841b8778a7f8ca2a24',
va: 16,
<html>
<head>
<title>{Title}{block:SearchPage} ({lang:Search results for SearchQuery}){/block:SearchPage}{block:PermalinkPage}{block:PostSummary} — {PostSummary}{/block:PostSummary}{/block:PermalinkPage}</title>
<meta charset="utf-8">
<meta name="description" content="{block:IndexPage}{block:Description}{MetaDescription}{/block:Description}{/block:IndexPage}{block:PermalinkPage}{block:PostSummary}{PostSummary}{/block:PostSummary}{/block:PermalinkPage}" />
<meta name="color:Accent" content="#4EA3D0"/>
<meta name="font:Body" content="'Helvetica Neue', Helvetica, Arial, sans-serif"/>
<meta name="if:Two column posts" content="1"/>
@tychio
tychio / backtop.js
Created April 11, 2013 07:55
go to page top
var backtop = document.getElementById('backtop');//need a button id is 'backtop'
backtop.onclick = function () {
backTimer = setInterval(_back, 30);
};
var backTimer;
function _back () {
var _body = document.documentElement;
if (!_body.scrollTop) {
_body = document.body;
}
require 'open-uri'
pollNumber = '7040303'
ourPick = '31993122'
uriString = 'http://polldaddy.com/n/64270c358614e8ef9383968590e82f73/'.concat(7040303).concat('?').concat(Time.now.to_i.to_s())
puts uriString
# Headers
HEADERS = {
'Host' => 'polldaddy.com',
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7',
# Using the web automation driver (watir-webdriver) through the tor network
# Automates webpage actions & bypasses the voting limit on polldaddy
# Casts a vote every 3 seconds for a total of 1000 votes
require 'watir-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new :http => '127.0.0.1:8118'
b = Watir::Browser.new :firefox, :profile => profile
#b = Watir::Browser.new :firefox
b.goto '/polldaddy.com/poll/7040303/'
@alfredormz
alfredormz / gist:5980621
Created July 12, 2013 01:04
Ruby One Liner Webserver
ruby -run -e httpd . -p 5000
@wecanspeak
wecanspeak / dumpTmuxColor
Created December 14, 2013 06:40
dump tmux color code
#!/bin/sh
printf "\n "
for i in {0..255} ; do
colcode="colour${i}"
printf "\x1b[38;5;${i}m%-10s " $colcode
if [ $((($i+1) % 8)) = 0 ] ; then
printf "\n "
fi
done
printf "\n"
@mamantoha
mamantoha / app.rb
Created October 26, 2011 14:35
Warden integration with Sinatra and DataMapper(w/ BCryptHash) - http://ruby-ua.blogspot.com/2011/10/user-datamapper-bcrypthash-warden.html
# -*- encoding: utf-8 -*-
require 'sinatra'
require 'slim'
require 'warden'
require 'dm-core'
require 'dm-migrations'
require 'dm-timestamps'
require 'dm-validations'
@t2
t2 / birthday_liker.rb
Last active September 23, 2016 14:10
Like and Comment on every 'Happy Birthday' post on your Facebook feed at once.
require 'date'
require 'koala'
class BirthdayLiker
FACEBOOK_TOKEN = 'your_oauth_key'
BIRTHDAY_WORDS = %w(birthday bday birfday birth born)
THANKS_OPTIONS = ['Thank you!', 'Thanks!', 'Appreciate it!']
DATE_TIME_FORMAT = '%Y-%m-%d'
def initialize(birthdate, opts={})