Skip to content

Instantly share code, notes, and snippets.

@roy
roy / gist:1127059
Created August 5, 2011 07:07
table grid
class Grid
constructor: (element, options) ->
@options = options || {}
@grid = ($ element)
@head = (@grid.find ".head")
@columns = (@head.find ".column")
@records = (@grid.find ".records")
@tables = (@grid.find ".table")
@resizing = false;
@roy
roy / plex_scan.sh
Created July 11, 2011 08:50
Plex Media Server refresh
#!/bin/sh
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname ${SCRIPT}`
export LD_LIBRARY_PATH="${SCRIPTPATH}"
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
ulimit -s 3000
/home/roy/PlexMediaServer/Plex\ Media\ Scanner --scan --refresh --section 1
echo "Scan 1 Successful: $(date)" >> /home/roy/CronLightScan.log
/home/roy/PlexMediaServer/Plex\ Media\ Scanner --scan --refresh --section 2
echo "Scan 2 Successful: $(date)" >> /home/roy/CronLightScan.log
$ watchr .watchr
(in /Users/roy/Sites/keyword_extractor)
keyword_extractor
✔ test1
stemmer
✔ Bad words get removed
✔ Diacritics get changed for their normal versions
✔ Non word characters should be removed
@roy
roy / gist:901654
Created April 4, 2011 13:48
basic carousel
(function(){
var Carousel = {
initialize: function(element){
if(!$(element)){ return; }
this.carousel = $(element);
this.picture_box = this.carousel.select(".pictures").first();
this.links = this.carousel.select("a");
this.arrow = this.carousel.select(".contents_container_arrow").first();
this.timeout = 8;
this.current = 0;
module ProcessAsset
def self.included(base)
base.extend ClassMethods
end
module InstanceMethods
def process
self.send("#{asset_name}_file_name")
end
end
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Pimp</title>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://pimp.maggie.test.royapps.nl">
<!-- <meta HTTP-EQUIV="REFRESH" content="0; url=http://plugin.mspsite.com/action/showservice.jsp?homePath=http://www.mspportal.com/community&serviceid=grimradiolist&res=1280x720">-->
</head>
<body>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Index</title>
<style type="text/css">
style {
display: block;
def top_articles_for(widget_page_title, current_user)
article_relations = widget_page_widgets_for(widget_page_title, current_user).all.collect(&:widget).collect do |widget|
widget.top_articles
end
article_relations.inject {|sum, x| sum | x}
end
@roy
roy / meta_where 3
Created February 17, 2011 09:08
how to chain these scopes with or
# rails3 + meta_where
name_relation = Article.where(:title >> "name")
name2_relation = Article.where(:title >> "name2")
# how to get an sql query like: "select * from articles where (title = 'name') or (title = 'name2')
@roy
roy / gist:822341
Created February 11, 2011 13:33
tap enhancement
class Object
def tap(method =nil, *params, &block)
block.call(self) if block
self.send(method, *params) if method
self
end
end