Skip to content

Instantly share code, notes, and snippets.

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

Subhan Nooriansyah subhanshuja

🏠
Working from home
View GitHub Profile
@prime31
prime31 / gist:5675017
Last active April 2, 2024 03:55
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@luthfihariz
luthfihariz / ListItem.java
Created December 30, 2012 02:59
Loading newsfeed in background
package com.ideaplay.sharee.utility;
import java.util.ArrayList;
public class ListItem {
private String contributorImageUrl;
private String itemTitle;
private String itemContent;
private String itemContributor;
private String itemPubDate;
@luthfihariz
luthfihariz / NewsActivity.java
Created December 7, 2012 15:52
Submenu with Action Bar Sherlock
//here code before...
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.article_menu, menu);
return super.onCreateOptionsMenu(menu);
}
public boolean onOptionsItemSelected(
@mlbright
mlbright / slidingwindowmap.py
Created September 5, 2012 03:35
Solution to the SlidingWindowMap coding challenge by Cedric Beust
# solution to http://beust.com/weblog/2012/09/02/coding-challenge-a-sliding-window-map/
import heapq
import time
class SlidingWindowMap(object):
def __init__(self,api_keys,max_count,period_minutes):
self.period = period_minutes * 60
self.pq = []
for api_key in api_keys: