Skip to content

Instantly share code, notes, and snippets.

@thanhhh
thanhhh / 1) Install
Created December 1, 2015 06:08 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@thanhhh
thanhhh / Linux Static IP
Created December 1, 2015 03:16 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@thanhhh
thanhhh / auto_post.php
Created November 17, 2015 08:27
Auto post to Facebook page
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Facebook\Authentication\AccessToken;
use Facebook\FacebookApp;
use Facebook\FacebookRequest;
session_start();
$app_id = '{APP ID}';
@thanhhh
thanhhh / get_page_access_token.php
Last active December 19, 2015 05:50
Get page access token from Facebook page
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Facebook\Authentication\AccessToken;
use Facebook\FacebookApp;
use Facebook\FacebookRequest;
session_start();
@thanhhh
thanhhh / callback.php
Created November 17, 2015 08:23
The callback page for get access token from Facebook
<?php
require_once __DIR__ . '/vendor/autoload.php';
session_start();
$fbData = array(
'app_id' => '{APP ID}',
'app_secret' => '{APP SECRET}',
'default_graph_version' => 'v2.2'
);
@thanhhh
thanhhh / get_user_access_token.php
Created November 17, 2015 08:21
Get user access token using Facebook SDK for PHP
<?php
require_once __DIR__ . '/vendor/autoload.php';
session_start();
$fbData = array(
'app_id' => '{APP ID}',
'app_secret' => '{APP SECRET}',
'profile_id' => '{PAGE ID}',
@thanhhh
thanhhh / MyAdapter.java
Last active November 17, 2015 06:28
How to update data of active fragment item
public static class MyAdapter extends FragmentStatePagerAdapter {
private SparseArray mPageReferenceMap
= new SparseArray();
//other code
@Override
public Object instantiateItem(ViewGroup viewGroup, int position) {
Object obj = super.instantiateItem(viewGroup, position);
//Add the reference when fragment has been create or restore
@thanhhh
thanhhh / auto_post.php
Last active November 17, 2015 08:09
Facebook PHP SDK Sample: Post As A Page
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Facebook\Authentication\AccessToken;
use Facebook\FacebookApp;
use Facebook\FacebookRequest;
session_start();
$app_id = '{APP ID}';
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ClearBeanstalkdQueueCommand extends Command {
/**