Skip to content

Instantly share code, notes, and snippets.

View yelinaung's full-sized avatar
🏠
Working from home

Ye Lin Aung yelinaung

🏠
Working from home
View GitHub Profile
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
# If you don't use filenames to version, lower the CSS and JS to something like
@yelinaung
yelinaung / gist:5763890
Created June 12, 2013 09:08
Application Controller
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :get_menu_ready
def after_sign_in_path_for(resource)
session[:return_to] = request.fullpath if request.get? and controller_name != "user_sessions" and controller_name != "sessions"
end
def after_sign_out_path_for(resource)
# Controller
def index
@locations = Location.all
respond_to do |format|
format.json { render json: @locations }
end
end
.pure-button-success,
.pure-button-error,
.pure-button-warning,
.pure-button-secondary {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.pure-button-success {
background: rgb(28, 184, 65); /* this is a green */
@yelinaung
yelinaung / gist:5915722
Created July 3, 2013 05:46
Java Date Compare
package introtocs;
import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class DateCompare {
/**
* @param args
11-10 18:00:31.423: W/dalvikvm(450): Unable to resolve superclass of Landroid/support/v4/app/_ActionBarSherlockTrojanHorse; (150)
11-10 18:00:31.423: W/dalvikvm(450): Link of class 'Landroid/support/v4/app/_ActionBarSherlockTrojanHorse;' failed
11-10 18:00:31.423: W/dalvikvm(450): Unable to resolve superclass of Lcom/actionbarsherlock/app/SherlockFragmentActivity; (160)
11-10 18:00:31.423: W/dalvikvm(450): Link of class 'Lcom/actionbarsherlock/app/SherlockFragmentActivity;' failed
11-10 18:00:31.423: W/dalvikvm(450): Unable to resolve superclass of Lorg/devcon/android/BaseActivity; (335)
11-10 18:00:31.423: W/dalvikvm(450): Link of class 'Lorg/devcon/android/BaseActivity;' failed
11-10 18:00:31.423: W/dalvikvm(450): Unable to resolve superclass of Lorg/devcon/android/HomeActivity; (1495)
11-10 18:00:31.434: W/dalvikvm(450): Link of class 'Lorg/devcon/android/HomeActivity;' failed
11-10 18:00:31.434: E/dalvikvm(450): Could not find class 'org.devcon.android.HomeActivity', referenced from method org.devcon.andr
@yelinaung
yelinaung / gist:7429659
Created November 12, 2013 11:54
DevCon PostMan
{"id":"1eea17a7-4fe8-8f5e-b384-1375ab2dd0d1","name":"DevCon API","timestamp":1383201440460,"requests":[{"collectionId":"1eea17a7-4fe8-8f5e-b384-1375ab2dd0d1","id":"48cbe48c-8bcf-b719-322a-81c033740ad7","name":"Speakers","description":"","url":"devconmyanmar.herokuapp.com/api/v1/speakers","method":"GET","headers":"","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2},{"collectionId":"1eea17a7-4fe8-8f5e-b384-1375ab2dd0d1","id":"cadc6a9d-b386-f75e-c1c4-6441d5f6ba03","name":"Schedules","description":"","url":"devconmyanmar.herokuapp.com/api/v1/schedules","method":"GET","headers":"","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2}]}
@yelinaung
yelinaung / gist:7522666
Created November 18, 2013 04:42
Get Talk Status
public boolean getTalkStatus(String tID) {
Cursor fav = mDb.rawQuery(
("SELECT " + DBHelper.tFAV + " FROM " + DBHelper.TABLE_TALK
+ " WHERE " + DBHelper.tID + " = " + tID), null);
// it makes me half my of day gone
fav.moveToFirst();
if (fav.getCount() > 0) {
do {
if (fav.getInt(0) == 0) {
private void onSpeakersQueryComplete(Cursor cursor) {
mSpeakersCursor = true;
final ViewGroup speakersGroup = (ViewGroup)
mRootView.findViewById(R.id.session_speakers_block);
// Remove all existing speakers (everything but first child, which is the header)
for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) {
speakersGroup.removeViewAt(i);
}
@yelinaung
yelinaung / overload.rb
Created January 8, 2014 11:45
Overloading in Ruby is not real "Overloading" because there is no data type declaration in ruby(dynamic typed language) . Ref : http://stackoverflow.com/questions/9373104/why-does-ruby-not-support-method-overloading
def say_hello(name)
puts "Hi #{name}"
end
# say_hello("devlabs")
def say_hello(name,age)
puts "Hi #{name} and your age is\n"
puts age
end
# say_hello("yelinaung",21)