Skip to content

Instantly share code, notes, and snippets.

View kalpesh-fulpagare's full-sized avatar
🎯
RubyOnRails, GoLang, AngularJS Developer

Kalpesh Fulpagare kalpesh-fulpagare

🎯
RubyOnRails, GoLang, AngularJS Developer
  • Scalefusion
  • Pune, India
View GitHub Profile
@kalpesh-fulpagare
kalpesh-fulpagare / nano.md
Last active August 29, 2015 13:57
Nano Shortcuts

Search text

Ctrl + W Type Text 'TEXT TO SEARCH'
Press 'Enter'
Press Alt + W to find next occurrence of text

Cut copy Paste

Select: ALT + M + A
Cut selected text/Current Line: Ctrl + K Copy: ALT + 6

@kalpesh-fulpagare
kalpesh-fulpagare / server.js
Last active August 29, 2015 13:57
RoR app with Wordpress on Nginx
$ cd /var/www
$ ll
drwxr-xr-x 5 root root 4096 Mar 7 12:52 wp
Installing php5-fpm
sudo apt-get install php5-fpm
php5-fpm configuration.Open up www.conf:
sudo nano /etc/php5/fpm/pool.d/www.conf
@kalpesh-fulpagare
kalpesh-fulpagare / sublime_packages.js
Last active August 29, 2015 13:55
Installing package manager
https://sublime.wbond.net/installation#st3
The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.
SUBLIME TEXT 3
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
SUBLIME TEXT 2
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.subl
@kalpesh-fulpagare
kalpesh-fulpagare / common.js.coffee
Last active August 29, 2015 13:55
My common js methods
flashTimer = null
$(document).ready ->
c = undefined
CommonJs =
settings:
domInputs: ->
$("input[type='text'], input[type='email'], input[type='password']")
init: ->
c = @settings
@kalpesh-fulpagare
kalpesh-fulpagare / postgres_install.sh
Last active August 29, 2015 13:55
Installing postgres in ubuntu
# https://help.ubuntu.com/10.04/serverguide/postgresql.html
$ sudo apt-get install postgresql postgresql-contrib
# To enable TCP/IP connections, edit the file /etc/postgresql/9.1/main/postgresql.conf
# and locate the line #listen_addresses = 'localhost' and
# change it to: listen_addresses = 'localhost'
$ sudo nano /etc/postgresql/9.1/main/postgresql.conf
$("form.validate:not([novalidate])").each(function() {
formValidations = {
errorElement: "span",
errorClass: "errorField",
rules: {},
messages: {}
};
$(this).find("input, select, textarea").each(function() {
if ($(this).data("rules") !== undefined) {
formValidations['rules'][$(this).attr('name')] = $(this).data("rules");
@kalpesh-fulpagare
kalpesh-fulpagare / alias.sh
Last active January 4, 2016 21:48
Ubuntu bash alias
# Edit .bashrc file with
$ cd
$ nano ~/.bashrc
# Add following lines if not present, if commented uncomment these lines
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
@kalpesh-fulpagare
kalpesh-fulpagare / log.js
Created January 15, 2014 06:42
js method for printing multiple variables on console
var log;
log = function() {
var i = 0;
while (i < arguments.length) {
console.log(arguments[i]);
i++;
}
return false;
};
@kalpesh-fulpagare
kalpesh-fulpagare / apple_push.rb
Created December 10, 2013 06:29
Apple Push Notification Ruby
require "rubygems"
require "yajl"
require "openssl"
require "socket"
device_token = '61 DIGIT iPhone_TOKEN'
device_token = device_token.gsub(" ", "")
the_byte_token = [device_token].pack("H*")
file = File.open("ruby_the_byte_token", "wb")
@kalpesh-fulpagare
kalpesh-fulpagare / apple_push.php
Created December 10, 2013 06:26
Apple Push Notification - PHP
<?php
// Put your device token here (without spaces):
$deviceToken = 'iPHONE_TOKEN';
// Put your private key's passphrase here:
$passphrase = 'kalpesh';
// Put your alert message here:
$message = 'Helllooooo check this My first push notification!';