Skip to content

Instantly share code, notes, and snippets.

View veekram's full-sized avatar
🐼
Focusing

Bikram Suwal veekram

🐼
Focusing
  • nbinfotech (p).ltd
  • Surybinayak , Bkt , Nepal
View GitHub Profile
@veekram
veekram / s3cmd_install.md
Created January 23, 2018 06:22 — forked from dominicsayers/s3cmd_install.md
Installing s3cmd on Ubuntu Server
  1. sudo apt-get install python-setuptools
  2. wget http://downloads.sourceforge.net/project/s3tools/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz
  3. tar xvfz s3cmd-1.5.0-alpha1.tar.gz
  4. cd s3cmd-1.5.0-alpha1
  5. python setup.py install
  6. s3cmd --configure
@veekram
veekram / rails_load_path_tips.md
Created January 30, 2018 18:07 — forked from maxim/rails_load_path_tips.md
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@veekram
veekram / rails_load_path_tips.md
Created January 30, 2018 18:07 — forked from maxim/rails_load_path_tips.md
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@veekram
veekram / button_spinner.css.sass
Created February 8, 2018 18:55 — forked from erotte/button_spinner.css.sass
Ajax loading indicator (Spinner) with Rails/SASS/Bootstrap 2/FontAwesome
%spinner
@extend [class^="icon-"]
@extend .icon-refresh
@extend .icon-spin
+transition(opacity 1s ease, width 0.7s ease, height 0.3s ease)
position: relative
top: -1px
display: inline-block
overflow: hidden
text-decoration: inherit
@veekram
veekram / friendly_urls.markdown
Created February 10, 2018 14:47 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://v1_0.validation.ws.chief.blau.de/">
<soapenv:Header/>
<soapenv:Body>
<v1:validateName>
<validationRequest>
<names>
<firstName>David</firstName>
<lastName>Hasselhoff</lastName>
@veekram
veekram / get_workers.rb
Created May 3, 2018 12:20 — forked from kerlin/get_workers.rb
Calling the Workday API in Ruby with Savon
#!/usr/bin/env ruby
#
# Example Ruby CLI script to retrieve worker data from Workday
# Call on command line with worker id; prints worker name
# add "request" or "response" after worker id and prints the
# outgoing xml or received hash and exits.
#
# Using Savon version 2 for the SOAP client (2.11.2)
#
# Savon defaults to making the message tag the same as the operation name
@veekram
veekram / postgres-cheatsheet.md
Created June 1, 2018 09:46 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@veekram
veekram / read-write-file.js
Created June 1, 2018 11:12
Read Write to file with javascript
/// write to file
var txtFile = "c:/test.txt";
var file = new File(txtFile);
var str = "My string of text";
file.open("w"); // open file with write access
file.writeln("First line of text");
file.writeln("Second line of text " + str);
file.write(str);
file.close();
@veekram
veekram / gist:9a5c482f2ebfd79704d78547960dbdce
Created July 12, 2018 10:39 — forked from eikes/gist:5a64b661022c756bd6522ed94770e2a6
List of Ruby on Rails Timezone names and their alias
["Africa/Algiers", "West Central Africa"],
["Africa/Cairo", "Cairo"],
["Africa/Casablanca", "Casablanca"],
["Africa/Harare", "Harare"],
["Africa/Johannesburg", "Pretoria"],
["Africa/Monrovia", "Monrovia"],
["Africa/Nairobi", "Nairobi"],
["America/Argentina/Buenos_Aires", "Buenos Aires"],
["America/Bogota", "Bogota"],
["America/Caracas", "Caracas"],