Skip to content

Instantly share code, notes, and snippets.

View hungdh9x's full-sized avatar
:octocat:
Not Found

Huy Hùng hungdh9x

:octocat:
Not Found
View GitHub Profile
@hungdh9x
hungdh9x / 00.md
Created January 11, 2018 02:33 — forked from maxivak/00.md
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@hungdh9x
hungdh9x / 1 Gist conventions
Created November 9, 2017 15:54 — forked from PavloBezpalov/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
@hungdh9x
hungdh9x / IconizedMenu.java
Created May 20, 2017 04:42 — forked from mediavrog/IconizedMenu.java
Android Compatibility popup menu with icons (requires support library v7)
package com.vuzz.snapdish.ui;
import android.content.Context;
import android.support.v7.internal.view.SupportMenuInflater;
import android.support.v7.internal.view.menu.MenuBuilder;
import android.support.v7.internal.view.menu.MenuPopupHelper;
import android.support.v7.internal.view.menu.MenuPresenter;
import android.support.v7.internal.view.menu.SubMenuBuilder;
import android.view.Menu;
import android.view.MenuInflater;
package com.hungdh.gcmdemo;
public class MainActivity extends AppCompatActivity {
private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private static final String TAG = "MainActivity";
private BroadcastReceiver mRegistrationBroadcastReceiver;
private ProgressBar mRegistrationProgressBar;
private TextView mInformationTextView;
private void sendRequest(int zodiacID, int gender) {
JSONObject params = new JSONObject();
try {
params.put(PARAM_ZODIAC_ID, String.valueOf(zodiacID));
params.put(PARAM_GENDER_ID, String.valueOf(gender));
params.put(PARAM_DATE, mDate);
} catch (JSONException e) {
e.printStackTrace();
}
<?php
/*
Plugin Name: REST API Custom
Plugin URI: http://hungdh.me
Description: Add metadata, end point to the REST API
Author: Huy Hung
Version: 1.0
Author URI: http://hungdh.me
*/
@hungdh9x
hungdh9x / db_query.sql
Created January 15, 2016 09:35
GCM with Android tutorial
CREATE TABLE IF NOT EXISTS `gcm_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gcm_regid` text,
`name` varchar(50) NOT NULL,
`email` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
@hungdh9x
hungdh9x / index.php
Created January 15, 2016 08:55
GCM with Android tutorial
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
});
@hungdh9x
hungdh9x / send_message.php
Last active March 16, 2016 09:44
GCM with Android tutorial
<?php
if (isset($_GET["regId"]) && isset($_GET["message"])) {
$regId = $_GET["regId"];
$message = $_GET["message"];
include_once './GCM.php';
$gcm = new GCM();
$registatoin_ids = array($regId);
$message = array("message" => $message);
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
@hungdh9x
hungdh9x / register.php
Created January 15, 2016 08:49
GCM with Android tutorial
<?php
/**
* Registering a user device
* Store reg id in users table
*/
$body = file_get_contents('php://input');
$postvars = json_decode($body, true);
if (isset($postvars["name"]) && isset($postvars["email"]) && isset($postvars["regId"])) {