Skip to content

Instantly share code, notes, and snippets.

:shipit:
Working

Wakim Jraige wakim

:shipit:
Working
Block or report user

Report or block wakim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wakim
wakim / push_fcm.ruby
Created Feb 6, 2018
Scrip to push data messages to android devices on firebase
View push_fcm.ruby
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('https://fcm.googleapis.com/fcm/send')
http_proxy = ENV['HTTP_PROXY']
https_proxy = ENV['HTTPS_PROXY']
proxy_host = nil
@wakim
wakim / notification.rb
Created Sep 25, 2017
Send notification based on platform
View notification.rb
def send_notification
fcm = FCM.new(ENV['FIREBASE_SERVER_KEY'], { mutable_content: true, content_available: true, priority: 'high' })
registration_ids = [event_slot.physiotherapist.firebase_token]
date = I18n.l(event_slot.appointment_time, format: :short)
payload = { data: { title: 'Você tem um novo agendamento', body: "Confirme sua disponibilidade para atender na #{franchise.nome}, #{date}" }, mutable_content: true, content_available: true, priority: 'high' }
if (event_slot.physiotherapist.platform == 'ios')
payload[:notification] = payload[:data]
end
View NetworkStatistics.kt
package br.com.wozapp.networkstatistics
import android.os.StrictMode
import br.com.wozapp.data.model.AppStatistics
import br.com.wozapp.data.model.TotalStatistics
class NetworkStatistics private constructor() {
companion object {
View MoneyTextWatcher.kt
import android.text.Editable
import android.text.TextWatcher
import android.text.method.DigitsKeyListener
import android.widget.EditText
import java.lang.ref.WeakReference
import java.math.BigDecimal
import java.text.NumberFormat
import java.util.*
View SimpleOrientationListener.java
import android.content.Context;
import android.content.res.Configuration;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.WindowManager;
import java.util.concurrent.locks.ReentrantLock;
public abstract class SimpleOrientationListener extends OrientationEventListener {
View CustomGlideModule.kt
import android.content.Context
import android.net.ConnectivityManager
import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.Registry
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader
import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.module.AppGlideModule
import okhttp3.OkHttpClient
import java.io.InputStream
@wakim
wakim / BottomNavigationBehavior.java
Created May 1, 2017
Improved implementation of BottomSheet Behavior
View BottomNavigationBehavior.java
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
@wakim
wakim / CustomSwipeRefreshLayout.kt
Created May 1, 2017
Improved version of SwipeRefresh that don't trigger refresh while setEnabled is called during scroll
View CustomSwipeRefreshLayout.kt
import android.content.Context
import android.support.v4.widget.SwipeRefreshLayout
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
/***
* Set the enabled property only when an touch up or touch cancel is detected
*/
class CustomSwipeRefreshLayout : SwipeRefreshLayout {
View Activity.java
mServiceIntent = new Intent(getActivity(), RSSPullService.class);
mServiceIntent.setData(Uri.parse(dataUrl));
// Inicia o IntentService
startService(mServiceIntent);
View AsyncTask.java
public class HeavyWorkTask extends AsyncTask<String, Void, String> {
TextView mStatusTextView;
public HeavyWorkTask(TextView statusTextView) {
mStatusTextView = statusTextView;
}
@Override
protected String doInBackground(String... urls) {
return doHeavyWork(urls[0]);
You can’t perform that action at this time.