Skip to content

Instantly share code, notes, and snippets.

View rafaelss's full-sized avatar

Rafael Souza rafaelss

View GitHub Profile
<!-- JEITO FEIO E BOBO -->
<a href="javascript:void(0);">texto do link</a>
<!-- JEITO BUNITO -->
<a href="#" onclick="return false;">texto do link</a>
<?php
class Callable {
public function __invoke(array $options) {
print_r($options);
}
}
class Model {
using System.Web.Mvc;
/*
* return new SimpleResult("Hello World");
* return new SimpleResult(1);
* return new SimpleResult(1257.14);
* return new SimpleResult(true);
*/
namespace Custom.Mvc
{
namespace Helper
{
public static class Convert
{
public static int ToInt(object value)
{
try
{
return System.Convert.ToInt32(value);
}
anemone.focus_crawl do
Anemone::Page.fetch("http://www.someurl.com/searchpage/", 'some=params&to=search').links
end
@rafaelss
rafaelss / a.js
Last active September 1, 2015 18:13
input.on("autocompleteselect", (function(self) {
return function(ev, ui) {
self.organizationId = ui.item.value;
self._enableContinue();
}
})(this));
function limitChars(textarea, limit, infodiv) {
$(textarea).observe("keyup", function(event) {
var text = $F(event.element());
var textlength = text.length;
var info = $(infodiv);
if(textlength > limit) {
info.innerHTML = 'You cannot write more then ' + limit + ' characters!';
event.element().setValue(text.substr(0, limit));
event.stop();
# instead
@object_1.reload
@object_2.reload
@object_3.reload
@object_4.reload
# use
[@object_1, @object_2, @object_3, @object_4].each(&:reload)
$ script/performance/benchmarker 50 'Date.new(2009, 1, 1)'
user system total real
#1 0.000000 0.000000 0.000000 ( 0.001889)
$ script/performance/benchmarker 50 'ThirdBase::Date.new(2009, 1, 1)'
user system total real
#1 0.000000 0.000000 0.000000 ( 0.000731)
#!/usr/bin/env ruby
## git-publish-branch: a simple script to ease the unnecessarily complex
## task of "publishing" a branch, i.e., taking a local branch, creating a
## reference to it on a remote repo, and setting up the local branch to
## track the remote one, all in one go. you can even delete that remote
## reference.
##
## Usage: git publish-branch [-d] <branch> [repository]
##