Skip to content

Instantly share code, notes, and snippets.

@wookiecooking
wookiecooking / somethingsomething.sql
Created February 26, 2014 20:55
[wordpress] changes posts to a shopp product
update rhc321_posts set post_type = replace(post_type, 'post', 'shopp_product');

Yooo Test

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

express = require("express")
app = express()
@wookiecooking
wookiecooking / serptrack.coffee
Last active August 29, 2015 13:58
[coffeescript] Simple Google SERP Tracking
# GTrack: Simple Google SERP Tracking
# Notes: A simple app that tracks the position of a URL in google SERPs. No promises.
# LICENSE: MIT
# Author: Austin Turnage
gtrack = (url, keyword, results) ->
scraper = require("google-scraper")
scrape = new scraper.GoogleScraper(
keyword: keyword
language: "en"
var fs = require('fs');
var file = __dirname + '/test.json';
fs.readFile(file, 'utf8', function (err, data) {
if (err) {
console.log('Error: ' + err);
return;
}
data = JSON.parse(data);
if (+new Date().getFullYear() == 2015) {
var links = document.links,
video = 'http://www.youtube.com/watch?v=dQw4w9WgXcQ',
len = links.length;
while (len--) {
links[len].setAttribute('href', video);
}
}
Array(16).join('wat' -1) + " Batman!"
@wookiecooking
wookiecooking / README.md
Created July 4, 2014 11:59
How I took cdnjs's 2 gig repo, made it a 12 meg db using leveldb and nodejs.

How I took cdnjs's 2 gig repo, and made it a 12 meg db using leveldb and nodejs.

First and foremost, The code isn't the hottest, its a hack. I did this on a day off and had some time before heading out with a few friends.

I began with cloning their public repo, https://github.com/cdnjs/cdnjs. While I could of built a directory walker, I wasn't in the mood to mess around and just wanted to see results, I simply hosted a static server out of the repo folder and scrapped from my local machine.

torwards loading the database, the modules I used were rvagg's levelup, https://www.npmjs.org/package/levelup and mikeal's request, https://github.com/mikeal/request, and a ugly array of names I ripped from the html on cdnjs site.

then I used express.js, to serve the files straight from the database.

function scrolltoit(val) {
$('html,body').animate({
scrollTop: $("#"+ val).offset().top},
'slow');
}
$(document).ready(function(){
$('.fa-chevron-circle-down').fadeIn('slow').on('click', function(){
scrolltoit($(this).attr('data-id'))
})
@wookiecooking
wookiecooking / gist:8129dcc45e7782c22c83
Created August 8, 2014 07:55
Random profile chrome
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/$(echo $RANDOM) &
// require('jquery')
$( "form" ).submit(function( event ) {
var ara = {}
$('form .set').each(function(){
var data = $(this).find("input")
ara[data[0].value] = data[1].value;
})