Skip to content

Instantly share code, notes, and snippets.

View surendrans's full-sized avatar

Surendran surendrans

View GitHub Profile
.factory('pushNotificationHandler', function($ionicPopup, $state) {
return {
action: function() {
if($state.current.name != "login") {
popupParams = {
template: '<p class="center-algin">There are some New requests.<br>Do you like to update?</p>',
title: 'Notification',
buttons: [{
text: 'Cancel'
}, {
java -jar selenium-server-standalone-2.43.1.jar -role hub
java -jar selenium-server-standalone-2.43.1.jar -role webdriver -hub http://192.168.1.10/grid/register -p 5566
@surendrans
surendrans / gist:0f1461a9e6486a8a8012
Created November 4, 2014 03:47
Prawn PDF - print
class PrintPurchaseOrder
def print
pdf = Prawn::Document.new(:page_size => "LETTER", :page_layout => :portrait)
header(pdf)
table_header(pdf)
footer(pdf)
pdf.render_file filename
end
end
@surendrans
surendrans / header.rb
Last active April 23, 2019 09:05
Prawn PDF
def header pdf
pdf.repeat :all do
pdf.bounding_box([0, 720], :width => 540, :height => 720) do
pdf.stroke_bounds
pdf.cell :content => "<b><font size='17'>Company Name PTE LTD</font></b>
email: info@spritle.com web: www.sptiele.com",
:inline_format => true,
:leading => 10,
:width => pdf.bounds.width,
:height => 110,
@surendrans
surendrans / page_break.css
Created November 4, 2014 04:33
PDFKIT - page break
@media print {
.page-break {
display: block;
page-break-before: always;
}
}
Using gem aws-sdk for a ror application for uploading images to s3
Uploading images to a fixed bucket with different folders for each object or application.
The s3 keeps a limitation on the number of buckets creattion whereas there is no
limitation for content inside a bucket.
This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public
so that the images uploaded are directly accessible. The input is takes is the image complete path
where it is present, folder in which it should be uploaded and user_id for whom it should
be uploaded.
@surendrans
surendrans / angular-animate.js
Last active August 29, 2015 14:10
Angular animate include js
var myApp = angular.module('myApp', ['ui.router','blockUI','showdown','delay','ngTouch','ngAnimate','autonext']);
myApp.config(function($stateProvider, $urlRouterProvider) {
$stateProvider.state('landing', {
url: "/landing",
controller: 'LandingCtrl',
templateUrl: "templates/landing.html"
})
}
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@surendrans
surendrans / unicorn
Last active August 29, 2015 14:14 — forked from shapeshed/unicorn
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production