This file contains hidden or 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
| $(window).scroll(function(e) { | |
| if ($(window).scrollTop() === $(document).height() - $(window).height()) { | |
| // ajax! | |
| } | |
| }); |
This file contains hidden or 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 'test/unit' | |
| class Object | |
| def blank? | |
| if self.respond_to?(:empty?) | |
| if self.class == String then self.strip.empty? else self.empty? end | |
| else | |
| self.nil? | |
| end | |
| end |
This file contains hidden or 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 'nokogiri' | |
| require 'net/http' | |
| require 'uri' | |
| target = 'http://www.buscacep.correios.com.br/servicos/dnec/consultaEnderecoAction.do' | |
| if ARGV[0].nil? | |
| puts "USAGE:" | |
| puts " ruby cep.rb xxxxxxxx" |
This file contains hidden or 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
| #!/bin/bash | |
| osascript << EOT | |
| tell application "System Events" | |
| sleep | |
| end | |
| EOT |
This file contains hidden or 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 ben = require('ben'); | |
| var fn = ben(100000, function() { | |
| var test = function() { return "test"; }; | |
| test(); | |
| }); | |
| var newFunction = ben(100000, function() { | |
| var test = new Function('', 'return "test"'); | |
| test(); |
This file contains hidden or 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 i = 6, | |
| list = {}; | |
| console.log('base: 16px'); | |
| console.log('-----------------'); | |
| while (i < 50) { | |
| var px = i + 'px', | |
| em = String(i/16) + 'em'; | |
| list[px] = em; |
This file contains hidden or 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
| >> Resolv::DNS.new.getresources("gmail.com", Resolv::DNS::Resource::IN::MX).map { |dns| dns.exchange.to_s } | |
| => ["alt3.gmail-smtp-in.l.google.com", "alt4.gmail-smtp-in.l.google.com", "gmail-smtp-in.l.google.com", "alt1.gmail-smtp-in.l.google.com", "alt2.gmail-smtp-in.l.google.com"] |
This file contains hidden or 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
| # separating emails by the host | |
| hash = {} | |
| %w{ [email protected] [email protected] }.each do |mail| | |
| id, host = mail.split("@") | |
| hash[host] ||= [] | |
| hash[host] << id | |
| end |
This file contains hidden or 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
| sed -e 's/^rvm \(.*\)/\1/' .rvmrc | grep '@' |
This file contains hidden or 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
| #! /bin/bash | |
| # GITLAB | |
| # Maintainer: @randx | |
| # App Version: 2.9 | |
| # from: https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab | |
| ### BEGIN INIT INFO | |
| # Provides: gitlab | |
| # Required-Start: $local_fs $remote_fs $network $syslog redis-server |