Discover gists
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
<?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> |
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
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 | |
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
// ==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')); |
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
unless Object.const_defined? 'WillPaginate' | |
module ActiveRecord | |
class Base | |
class << self | |
def paginate( options = {} ) | |
find( :all, options.except( :page, :per_page ) ) | |
end | |
end |
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
%% 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); |
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
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 |
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
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" |
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
/*------------------------------------------------------------------------------------------- | |
| 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 |
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
<VirtualHost *:80> | |
ServerName dropbox.cylenceweb.com | |
DocumentRoot /opt/dropbox | |
<Directory "/opt/dropbox"> | |
Options Indexes FollowSymLinks | |
AllowOverride None | |
Order allow,deny | |
Allow from all | |
</Directory> |
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
class Users < Application | |
# === Option 1 === | |
def create | |
@user = User.first | |
User.allow_access(:staff) do | |
@user.update_attributes :staff => true | |
end | |
end | |