Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:param name="start" select="0"/>
<xsl:param name="count" select="5"/>
<xsl:template match="rss">
<xsl:for-each select="channel/item[position() > $start][position() < $count + 1]">
<!-- Do not show channel image -->
<br>
from threading import _Timer
class Timer(_Timer):
def __init__(self, interval, handler, repeats=0, args=[], kwargs={}):
_Timer.__init__(self, interval, self.__invoke, args, kwargs)
self.handler = handler
self.repeats = repeats
// ==UserScript==
// @name popIn in GreaseMonkey
// @namespace http://gist.github.com
// @include *
// ==/UserScript==
window.addEventListener("load" , function(){
if(document.getElementById('popInContainer')) { Bpopin_cleanUp(); }
else {
popin=document.body.appendChild(document.createElement('script'));
unless Object.const_defined? 'WillPaginate'
module ActiveRecord
class Base
class << self
def paginate( options = {} )
find( :all, options.except( :page, :per_page ) )
end
end
@Arbow
Arbow / dame_shit.erl
Created July 28, 2008 02:10
These codes show bugs in Erlang's SUB BINARY OPTIMIZED mechanism
%% Notice:These codes show bugs in Erlang's SUB BINARY OPTIMIZED mechanism
-module(dame_shit).
-export([main/0, dame_shit/1, dame_shit2/1]).
dame_shit(Bin) ->
dame_shit(Bin, not_found).
dame_shit(Bin, found) ->
{found, Bin};
dame_shit(<<"\r\n", T/binary>>, not_found) ->
dame_shit(T, found);
lambda {
string_or_symbol = lambda { |arg| arg.kind_of?(String) || arg.kind_of?(Symbol) }
Waves::ResponseMixin.module_eval do
[ :models, :controllers, :views, :helpers ].each do |k|
functor( k ) { app[ k ] }
functor( k, string_or_symbol ) { |name| app( name )[ k ] }
end
end
}.call
Cassady:~/dev/scratch/plugin-testing yossef$ script/console
Loading development environment (Rails 2.0.2)
/>> cat = Category.new
=> #<Category id: nil, name: nil>
>> cat.name = 'testing'
=> "testing"
>> i = Item.new
=> #<Item id: nil, code: nil, category_id: nil>
>> i.code = 'test-1234'
=> "test-1234"
/*-------------------------------------------------------------------------------------------
| ECOTree.js
|--------------------------------------------------------------------------------------------
| (c) 2006 Emilio Cortegoso Lobato
|
| ECOTree is a javascript component for tree drawing. It implements the node positioning
| algorithm of John Q. Walker II "Positioning nodes for General Trees".
|
| Basic features include:
| - Layout features: Different node sizes, colors, link types, alignments, separations
<VirtualHost *:80>
ServerName dropbox.cylenceweb.com
DocumentRoot /opt/dropbox
<Directory "/opt/dropbox">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
class Users < Application
# === Option 1 ===
def create
@user = User.first
User.allow_access(:staff) do
@user.update_attributes :staff => true
end
end