View inject.js
1 2 3
$('.item').each(function(i) {
$(this).append('<a style="position:absolute;top:0;right:0" href="' + '/x/a/' + $(this).data('id') + '">X</a>')
});
View index.html
1 2 3 4 5 6 7 8 9 10
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
div {
display: none;
width: 100px; height: 100px;
View facebook-dl
1 2 3
# Ex.: https://www.facebook.com/video.php?v=469066063208329
 
video=469066063208329; curl -s $(curl -s https://www.facebook.com/video.php?v=$video | grep -o 'https.*thumbnail_src' | sed 's/\\u00253A/:/g' | sed 's/\\u00255C\\u00252F/\//g' | sed 's/\\u002526/\&/g' | sed 's/\\u00253D/=/g' | sed 's/\\u00253F/?/g' | sed 's/\\u002522\\u00252C\\u002522thumbnail_src//g') > $video.mp4
View nginx.conf
1 2 3 4 5 6 7 8 9
# use the socket we configured in our unicorn.rb
upstream unicorn_appname {
server unix:/tmp/unicorn.appname.sock fail_timeout=0;
}
 
server {
listen 80;
server_name appname.com.br;
rewrite ^/(.*) http://www.appname.com.br/$1 permanent;
View gist:b182209fbe127fea46c1
1 2 3 4 5 6 7 8 9
 
QSemaphore semaphorePlacedActivity;
QSemaphore finishedSemaphore;
 
extern Timetable gt;
 
static bool swappedActivities[MAX_ACTIVITIES];
 
static bool foundGoodSwap;
View gist:f932a3242f93919e4f05
1 2 3 4 5 6 7 8 9 10
alias reload="source ~/.bash_profile"
alias lsc="ls -G"
alias ll="ls -Glahs"
alias ls="ls -GF"
alias showip="ifconfig | grep broadcast | sed 's/.*inet \(.*\) netmask.*/\1/'"
alias myip="curl whatismyip.nodejitsu.com/index.txt" # alias myip="wget http://myipaddress.com -O - -o /dev/null |grep '<b>'| sed -E 's/<p><b>//g'|sed -E 's/<\/b>//g'"
alias cleanup="sudo rm -rf /private/var/log/asl/*"
alias xmlget="curl -X GET -H 'Accept: application/xml'"
alias jsonget="curl -X GET -H 'Accept: application/json'"
alias xmlpost="curl -X POST -H 'Accept: application/xml'"
View rails_resources.md

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
View monitrc
1 2 3 4 5 6 7 8 9 10
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file, a complete list of statements and
## options please have a look in the monit manual.
View webserver.sh
1 2 3 4 5 6 7 8 9 10
ssh root@ip
passwd
useradd -m -s /bin/bash deployer
echo "deployer:secret" | chpasswd
visudo
deployer ALL=(ALL) NOPASSWD: ALL
su deployer
cd
sudo apt-get update
sudo ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
View deploy.rb
1 2 3 4 5 6 7 8 9 10
require "bundler/capistrano"
 
# --------------------------------------------------
# nginx
namespace :nginx do
%w[start stop restart].each do |command|
desc "#{command} nginx"
task "#{command}", roles: :web do
sudo "service nginx #{command}"
end
Something went wrong with that request. Please try again.