Skip to content

Instantly share code, notes, and snippets.

@makunomark
makunomark / Activity.java
Last active August 22, 2017 10:15
Android Banner View with ViewPager
...
CustomPagerAdapter mCustomPagerAdapter;
ViewPager mViewPager;
mCustomPagerAdapter = new CustomPagerAdapter(Home.this, imageList);
mViewPager = (ViewPager) findViewById(R.id.pager);
CirclePageIndicator circlePageIndicator = (CirclePageIndicator) findViewById(R.id.titles);
if (mViewPager != null && circlePageIndicator != null) {
@makunomark
makunomark / Home.java
Last active September 27, 2021 15:54
To create an android bouncy badge on toolbar icon
public class Home extends AppCompatActivity{
...
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_shop, menu);
for (int i = 0; i < menu.size(); i++) {
Drawable drawable = menu.getItem(i).getIcon();
if (drawable != null) {
drawable.mutate();
drawable.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
%{
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int num_string = 0;
int num_char = 0;
%}
string [^\n\t ]+
%%
%{
int in_string_array(char*, char**, int);
char **words;
int words_count = 0;
%}
%%
/* Match all words */
[^ \t\n]+ {
@makunomark
makunomark / data.java
Created June 19, 2018 10:02
List of countries, codes and phone codes
public class data {
public static final String[] countryNames = { "Afghanistan", "Albania",
"Algeria", "Andorra", "Angola", "Antarctica", "Argentina",
"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahrain", "Bangladesh", "Belarus", "Belgium", "Belize", "Benin",
"Bhutan", "Bolivia", "Bosnia And Herzegovina", "Botswana",
"Brazil", "Brunei Darussalam", "Bulgaria", "Burkina Faso",
"Myanmar", "Burundi", "Cambodia", "Cameroon", "Canada",
"Cape Verde", "Central African Republic", "Chad", "Chile", "China",
@makunomark
makunomark / README.md
Created September 27, 2018 03:22
Bash script to quickly change your git configs

Set the file as an executable

On Mac

  • Save file without an extension
  • Right click and select Get info
  • Click on the lock icon (set to unlocked)
  • Open terminal and navigate to saved location on file
  • execute chmod 700 switch_git
  • run the file :-)