Skip to content

Instantly share code, notes, and snippets.

View billyriantono's full-sized avatar
:octocat:
git commit -m "Welcome"

Billy R billyriantono

:octocat:
git commit -m "Welcome"
  • Around the world
View GitHub Profile
@billyriantono
billyriantono / ScrappingBCA
Created December 25, 2014 04:27
Scrapping Mutasi BCA by adiputra
<?php
class ScrapBCA {
private $ipaddress;
private $user = 'user klik bca';
private $pass = 'pass klik bca';
private $bca_url = 'https://ibank.klikbca.com/';
private $bca_url_login = 'https://ibank.klikbca.com/authentication.do';
private $bca_url_menu = 'https://ibank.klikbca.com/nav_bar_indo/menu_bar.htm';
public function __construct() {
@billyriantono
billyriantono / Google.Contacts.v3.cs
Last active August 29, 2015 14:16
Google.Apis.Contacts.v3.Data
// Coded By Billy Riantono (at) 2015
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
public class NetworkChangeReceiver extends BroadcastReceiver{
private static final String LOG_TAG = "NetworkChangeReceiver";
private boolean isConnected = false;
@Override
public void onReceive(Context context, Intent intent) {
Log.v(LOG_TAG, "Receieved notification about network status");
isNetworkAvailable(context);
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
<?php
$mongodb = new Mongo("mongodb://username:password@localhost/database_name");
$database = $mongodb->database_name;
$collection = $database->collection;
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$limit = 12;
$skip = ($page - 1) * $limit;
$next = ($page + 1);
$prev = ($page - 1);
@billyriantono
billyriantono / ToolbarUtil.java
Created May 18, 2015 08:21
Change ActionToolbar Android to be transparent
public static void transparentBackgroundToolbarsIcon(Toolbar toolbarView) {
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
if (v != null && v instanceof TextView) {
TextView t = (TextView) v;
t.setBackgroundResource(R.drawable.background_transparent);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(getResources().getColor(R.color.some_color));
}
public abstract class HeaderFooterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int VIEW_TYPE_MAX_COUNT = 1000;
private static final int HEADER_VIEW_TYPE_OFFSET = 0;
private static final int FOOTER_VIEW_TYPE_OFFSET = HEADER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private static final int CONTENT_VIEW_TYPE_OFFSET = FOOTER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private int headerItemCount;
private int contentItemCount;
private int footerItemCount;
Hex Opacity Values
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
@billyriantono
billyriantono / sample
Created February 12, 2016 04:11
change navigation bar default by code
UINavigationBar.appearance().barTintColor = UIColor(red: 234.0/255.0, green: 46.0/255.0, blue: 73.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]