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 'rubygems' | |
require 'mysql' | |
mysql = Mysql.real_connect("localhost", "root", "pass", "db") | |
results = mysql.query("select wp_term_taxonomy.term_taxonomy_id as taxo_id, count(*) as count from wp_term_taxonomy | |
left join wp_term_relationships on wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id | |
where (wp_term_taxonomy.parent = 6 or wp_term_taxonomy.term_id = 6) group by term_id;") | |
results.each { |e| | |
mysql.query("UPDATE WP_TERM_TAXONOMY SET COUNT = #{e[1]} WHERE WP_TERM_TAXONOMY.TERM_TAXONOMY_ID = #{e[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
$(function() { | |
// var pathArray = window.location.pathname.split("/") | |
console.log(GetAlbums.getUrlVars()["name"]) | |
// if (typeof GetAlbums.getUrlVars()["name"] === "undefined") | |
// window.location.pathname = "/Stuff" | |
//for(i=0; i<= pathArray.length; 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
/* jquery code for Contact form overlay starts here */ | |
var location = window.location; | |
$("#cpage").val(location); | |
// console.log("Current href: "+location); | |
var email = $("a[href^='mailto:']").text(); | |
$("a[href^='mailto:']").attr('id', 'messagewindow'); | |
$("a[href^='mailto:']").attr('href', '#'); | |
if(email == ""){ |
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
// http://localhost:8080/index?id=546&name=kengimel | |
var id = myVars.getUrlVars()["id"]; | |
var name = myVars.getUrlVars()["name"]; | |
console.log("ID is currently this value: "+id); | |
console.log("Name is currently this value: "+name); | |
var myVars= { | |
getUrlVars: 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
var s = document.createElement('script'); | |
s.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'); | |
document.body.appendChild(s); | |
s.onload=function(){ | |
// alert("hello") | |
//Js code | |
}; | |
void(s); |
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
// Taken from the programming in Scala book second edition page 138 | |
// Returns a row as a sequence | |
def makeRowSeq(row: int) = | |
for (col <- 1 to 10) yield { | |
val prod = (row * col).toString | |
val padding = " " *(4 - prod.length) | |
padding + prod | |
} |
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
jQuery.fn.stripTags = function() { | |
return this.replaceWith( this.html().replace(/<\/?[^>]+>/gi, '') ); | |
}; | |
$("#any").stripTags(); |
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
import org.bowlerframework.view.squery.component.ValidationFeedbackPanel._ | |
import org.bowlerframework.view.squery.Component | |
import org.bowlerframework.RequestScope | |
class NewWidgetForm extends Component{ | |
val request = RequestScope.request | |
$("#errorPanel").contents = showErrorMessages | |
request.getSession.getValidatedModel match{ |
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
package com.mojolly.backchat | |
package web | |
import org.scalatra.ScalatraServlet | |
import akka.actor.{Scheduler, Actor} | |
import javax.servlet.http.{HttpServletResponse, HttpServletRequest} | |
import org.atmosphere.cpr.BroadcastFilter.BroadcastAction | |
import org.atmosphere.cpr._ | |
import org.atmosphere.util.XSSHtmlFilter | |
import collection.JavaConversions._ |
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
import java.text.SimpleDateFormat | |
import java.util.Date | |
class RichHumanDate(d:Long) { | |
def toHumanString() = { | |
val sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS"); | |
val dt = new Date(d); | |
sdf.format(dt); | |
} | |
} |