Skip to content

Instantly share code, notes, and snippets.

Shavit shavit

  • USA
Block or report user

Report or block shavit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shavit /
Created Jul 4, 2012
Export HTML table to CSV using javascript.
$("#btnExportHTMLToCSV").click((event) ->
$table = $("#tableToExport")
if !$table
return false
headers = []
csv = ""
$table.find("thead th").each(() ->
$th = $(this)
text = $th.text()
header = '"'+text+'"'
shavit /
Created Feb 28, 2013
Facebook JavaScript SDK in CoffeeScript
# You should add the Facebook App ID and the channel url (optional), in the #fb-root element, as a data- attribute:
# <div id="fb-root" data-app-id="<%= ENV['FACEBOOK_APP_ID'] %>" data-channel-url="<%= url_no_scheme('/channel.html') %>"></div>
window.fbAsyncInit = ->
appId: document.getElementById("fb-root").getAttribute("data-app-id")
channelUrl: document.getElementById("fb-root").getAttribute("data-channel-url")
status: true,
cookie: true,
shavit / facebook_apps_controller.rb
Created Mar 15, 2013
Facebook page and canvas apps with Rails 4, can lead to a blank white page. In Rails 4, the X-Frame-Options are sets by default, and you should override them, to allow iframes in Rails.
View facebook_apps_controller.rb
class FacebookClubsController < ApplicationController
layout "facebook_canvas"
after_filter :allow_iframe
def index
View test_helper.rb
# If you are working with the foreman gem and .env files, you are probably need to load
# the environment varialbes from the .env file.
# Load the environment variables from the .env file in development.
open('.env', 'r').readlines.each {|l| kv = l.split('='); ENV[kv[0]] = kv[1];}
shavit / post-receive
Created Oct 20, 2014
Git deployment for Ruby on Rails applications in production
View post-receive
# Production environment
export RAILS_ENV="production"
echo "---> An Error Has Occurred!"
shavit /
Created Aug 20, 2015
Compile Nginx with ramp module
./configure \
--user=nginx \
--group=nginx \
--prefix=/usr/share/nginx/nginx-1.7.12 \
--add-module=../nginx-rtmp-module-master \
--sbin-path=/usr/local/sbin/nginx \
--conf-path=/usr/share/nginx/nginx-1.7.12/conf/nginx.conf \
--pid-path=/var/run/ \
--error-log-path=/var/log/nginx/error.log \
shavit / post-receive
Created Jan 11, 2016
Git deployment for Go Revel application
View post-receive
# /<REPOS-PATH>/<REPO-NAME>.git/hooks/post-receive
echo "---> An Error Has Occurred!"
echo "---> Receiving push as $USER"
git --work-tree=/<APP-PATH> --git-dir=/<REPOS-PATH>/<REPO-NAME>.git checkout -f
shavit / go-revel-app.conf
Created Jan 11, 2016
Run Go Revel app in production as a service
View go-revel-app.conf
start on runlevel [2345]
stop on runlevel [!2345]
setuid <APP-NAME>
chdir /<APP-PATH>
shavit / app
Created Jan 11, 2016
Nginx reverse proxy for Go Revel web application. Also redirects from www to non-www. You can also let Nginx handle the static files with another location block.
View app
upstream app {
server {
listen 80;
return 301;
shavit / mass_video_importer_1.rb
Created Jan 14, 2016
Mass video importer from *.csv files to tube sites.
View mass_video_importer_1.rb
# Import videos from CSV
# CSV row:
# 0 - embedded_video
# 1 - link
# 2 - categories (Funny;Euro;Cam)
# 3 - rating
# 4 - author username
You can’t perform that action at this time.