This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION benchmark( | |
IN query text, | |
OUT total_cost double precision, | |
OUT runtime double precision | |
) | |
RETURNS record | |
LANGUAGE plpgsql | |
STRICT AS | |
$$DECLARE | |
j json; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
module PushTokensHelper | |
def send_pushes(user, data) | |
PushToken.where(user: user).to_a.each do |push_token| | |
send_push_to_device(push_token, data) | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FacebookLoginHelper | |
def login_with_facebook | |
return unless fetch_fb_profile | |
setup_user_by_fb | |
create_token_info | |
set_token_on_user | |
if User.devise_modules.include?(:confirmable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void logStackTrace() { | |
(new Throwable()).printStackTrace(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class UniqueIdUtility { | |
static private int id; | |
static { | |
id = Integer.MIN_VALUE + new Random().nextInt(Integer.MAX_VALUE); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
.img_fitted { | |
background-position: center; | |
background-size:cover; | |
width: 100%; | |
color: #fff; | |
} | |
.img_fitted img { | |
max-width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GcmUtil { | |
public static String getToken(Context context) throws IOException { | |
InstanceID instanceID = InstanceID.getInstance(context); | |
return instanceID.getToken(context.getString(R.string.gcm_defaultSenderId), | |
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); | |
} | |
public static String getTokenOnThread(final Context context) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum HttpStatus { | |
UNAUTHORIZED(401), | |
FORBIDDEN(403), | |
NOT_FOUND(404), | |
OTHER_ERROR(null); | |
private static HashMap<Integer, HttpStatus> map; | |
private Integer code; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ListView | |
android:id="@+id/list_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:animationCache="false" | |
android:cacheColorHint="@color/transparent" | |
android:divider="@color/transparent" | |
android:dividerHeight="0dp" | |
android:listSelector="@color/transparent" | |
android:scrollingCache="false"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ListViewAdapter <T> extends BaseAdapter { | |
protected ListView listView; | |
private ArrayList<T> objects = new ArrayList<T>(); | |
public void updateData(ArrayList<T> objects) { | |
this.objects = objects; | |
notifyDataSetChanged(); | |
} | |
NewerOlder