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
require 'csv' | |
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, :confirmable, :token_authenticatable, | |
:recoverable, :rememberable, :trackable, :authentication_keys => [:rollno] | |
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
require 'haml' | |
class ErbEngine < Haml::Engine | |
def push_script(text, preserve_script, in_tag = false, preserve_tag = false, | |
escape_html = false, nuke_inner_whitespace = false) | |
push_text "<%= #{text.strip} %>" | |
end | |
def push_silent(text, can_suppress = false) | |
push_text "<% #{text.strip} %>" |
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
upstream railsapp { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a single worker for timing out). | |
server 10.0.0.5:8182; | |
#server unix:/var/www/meralabour/tmp/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name app.atsquare.in; |
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
Lib.ajax.getJSON({ | |
url: 'https://api.twitter.com/1/statuses/user_timeline.json?&screen_name=gabromanato&callback=?&count=1', | |
type: 'jsonp' | |
}, function(tweet) { | |
document.querySelector('#tweet').innerHTML = tweet[0].text; | |
}); |
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
var pageUrl = "http://something.com/gsm"; | |
var interactionId = "email-form"; //id of the product | |
document.getElementsByClassName(interactionId).onsubmit = function AfterFunction(e){ | |
var xmlhttp; | |
if (window.XMLHttpRequest) { | |
// code for IE7+, Firefox, Chrome, Opera, Safari | |
xmlhttp = new XMLHttpRequest(); | |
} else { |
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
upstream myapp{ | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a single worker for timing out). | |
server 127.0.0.1:3000; | |
} | |
server { | |
#listen 80 ssl; | |
listen 443 ssl; |
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
var now = new Date(); | |
var currMonth = now.getMonth(); | |
var currYear = now.getFullYear(); | |
var date = now.getDate(); | |
var weekDay = new Array(7); | |
weekDay[0] = "Sun"; | |
weekDay[1] = "Mon"; | |
weekDay[2] = "Tue"; |
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
namespace :sp do | |
authors = %w/Magesh Bala Vikram Abraham Imran Satish Harish Varun Jayamohan Ramesh Raghuvamsan Yogesh Yuvaraja Ranjith Kavitha Safia Surya Priya Shalini Priyanka/ | |
publishers = ["Tamil Nadu TextBook Corporation"] | |
al = authors.length | |
pl = publishers.length | |
task :textbooks => :environment do | |
TextBook.delete_all |
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
#!/usr/bin/env ruby | |
## WP2TUMBLR: WordPress 2 Tumblr Importing tool | |
## | |
## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE | |
## | |
## Import the WORDPRESS_XML_FILE to a Tumblr blog. | |
## Provide `--group` option to publish to a group. | |
## This could take a long time... | |
## | |
## To install, download the script and chmod to 755. |
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
require 'rubygems' | |
require 'net/http' | |
require 'nokogiri' | |
TUMBLR_USER = 'your@email.com' | |
TUMBLR_PASS = 'yourpassword' | |
url = URI.parse('http://www.tumblr.com/api/write') | |
# Read the WP export file |
OlderNewer