Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
🎯
Focusing

Karthik Sirasanagandla karthiks

🎯
Focusing
View GitHub Profile
@karthiks
karthiks / LearningResources.md
Last active September 27, 2015 18:45
Learning Resources

Quotes

"The more we see, the more we are capable of seeing." –Maria Mitchell

Learning Resources

  • edX free online courses from the world's best universities.
  • Degreed turn learning into skills
  • Skillshare a learning community for creators.
  • Highbrow bite-sized courses delivered to your inbox every morning.
  • Coursera free online classes from 120+ top universities and educational organisations.
  • 99U education that you didn’t get in school, highlighting real-world best practices for making ideas happen.
@karthiks
karthiks / webapp_android.java
Last active May 17, 2020 13:32
Convert HTML5 into standalone Android App
//Ref. http://stackoverflow.com/questions/12840977/convert-html5-into-standalone-android-app
//Ref. http://gamedev.stackexchange.com/questions/8599/packaging-html5-games-as-applications-for-iphone-android
//1. Create an Android app using Eclipse.
//2. Create a layout that has a <WebView> control.
public class WebApp extends Activity {
protected void onCreate(Bundle savedInstanceState) {
WebView wv = new WebView(this);
wv.loadUrl("http://www.myapp.com/");
@karthiks
karthiks / Heroku-CheatSheet.md
Created March 13, 2015 18:51
Heroku CheatSheet When You Have Several Apps In Your Account

Heroku CheatSheet When You Have Several Apps In Your Account

Restart App in Heroku

heroku restart -a my-app-name

Fetch Environment configuration for a particular app

heroku config --app my-app-name

Set Environment key/value pair for a particular app

heroku config:set key1=value1 key2=value2 key3=value3 --app my-app-name

@karthiks
karthiks / application_controller.rb
Created March 13, 2015 11:03
Configuration to Auto redirect of http:// protocol to https://
class ApplicationController < ActionController::Base
force_ssl if: :ssl_configured?
# Your Other Stuff...
private
def ssl_configured?
Rails.env.production?
end
end
@karthiks
karthiks / duplication_okay.rb
Created February 19, 2015 03:00
When duplication is okay..
#Which is more readable?
# v[0].respond_to?(:downcase) || v[1].respond_to?(:downcase)
# v.map {|e| e.respond_to?(:downcase)}.any?
# A use-case from production code:
def self.changed_attributes?(lead)
changed = false
lead.changes.each do |k,v|
#if v[0].respond_to?(:downcase) || v[1].respond_to?(:downcase) # To Me This Is More Readable
if v.map {|e| e.respond_to?(:downcase)}.any?
@karthiks
karthiks / hr-spam-mails.txt
Created December 22, 2014 09:03
Reply to HR mails that spam your inbox
Hey HR,
Pleased by your mail. How about a return offer? We are looking forward to hire enthusiastic Jr. HRs in our company.
Should you be interested, do feel free to forward your resume to our HR.
Our folks should be interested to talk to you about an opportunity to have you onboard.
Cheers!
Karthik
@karthiks
karthiks / convert_avi_to_mp4.rb
Last active August 29, 2015 14:05
Convert avi file to mp4 media file using ffmpeg and Ruby
#!/usr/bin/env ruby
puts "Starting.."
#Dir['path/to/dir/*'].select { |e| File.file?(e) }
Dir.glob("./*.avi").each do |filename|
puts "Converting File name: #{filename}"
puts `mkdir "#{File.join( File.dirname(filename), "mp4")}"`
newfilename = File.join(
File.dirname(filename),
@karthiks
karthiks / modify_title_metadata_tag.rb
Created September 1, 2014 16:58
To set the title metadata tag of a media file to that of its base_file_name
#!/usr/bin/env ruby
puts "Starting.."
require 'taglib'
#Dir['path/to/dir/*'].select { |e| File.file?(e) }
Dir.glob("./*.wma").each do |filename|
puts "File name: #{filename}"
TagLib::FileRef.open(filename) do |f|
title = File.basename(filename, ".*")
@karthiks
karthiks / from-express3.js
Created August 9, 2014 10:06
Code from Express 3.x version in Node.js platform
var express = require('express');
var http = require('http');
var web_app = express();
var web_server = http.createServer(web_app);
web_app.get('/', function(request, response) {
response.send('Hello World');
});
@karthiks
karthiks / pre-express3.js
Created August 9, 2014 09:58
Code during pre Express 3.x days in Node.js platform
var express = require('express');
var web_app = express();
web_app.get('/', function(request, response) {
response.send('Hello World');
});
web_app.listen(8080, function() {
console.log("The server is now up and running...listening on port %d", web_app.address().port);