Skip to content

Instantly share code, notes, and snippets.

@sazid
sazid / polymer-core-toolbar.css
Created October 25, 2014 15:34
CSS for styling polymer elements
body {
font-family: "RobotoDraft";
font-weight: 300;
}
core-animated-pages {
width: 85%;
height: 85%;
-webkit-user-select: none;
overflow: hidden;
@sazid
sazid / SquareFrameLayout.java
Created September 24, 2015 20:17
A SquareFrameLayout for use with the RecyclerView
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Mohammed Sazid-Al-Rashid
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) {
getFragmentManager().popBackStack(null,
FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference != null) {
if (preference instanceof PreferenceScreen) {
if (((PreferenceScreen) preference).getDialog() != null) {
((PreferenceScreen) preference)
.getDialog()
.getWindow()
@sazid
sazid / masker.py
Created January 17, 2017 16:58
Python character masking/unmasking
def mask_characters(str):
str = str.replace('~', '~')
str = str.replace('!', '!')
str = str.replace('@', '@')
str = str.replace('#', '#')
str = str.replace('$', '$')
str = str.replace('%', '%')
str = str.replace('&', '&')
str = str.replace("'", ''')
str = str.replace('"', '"')
#include <stdio.h>
#include <math.h>
int main()
{
int a, b, c;
double root_1, root_2;
printf("For ax^2 + bx + c = 0 ; give the following inputs.\n");
printf("Input a: ");
@sazid
sazid / ARRAY_PROBLEMS.c
Last active March 15, 2017 14:10
C programs for practise
#include <stdio.h>
void main() {
int x[7];
int i;
// ----- START OF 1 ----- //
printf("\n\n1. TAKE INPUT AND SHOW THE RESULT ------------------\n\n");
// TAKE INPUT FROM THE USER
#include <stdio.h>
int maxIdx(int x[], int size) {
int i;
int m = x[0];
int idx = 0;
for (i = 0; i < size; i++) {
if (m < x[i]) {
m = x[i];
tinymce.init({
selector: 'textarea#doc_editor',
height: 500,
theme: 'modern',
plugins: [
'advlist placeholder autolink lists link image media charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking table contextmenu directionality',
'emoticons paste textcolor colorpicker textpattern codesample'
],
#include <stdio.h>
// 1. Sum of max numbers from each row
int sum_row_max(int x[3][3]) {
int sum = 0;
int i, j, max;
for (i = 0; i < 3; i++) {
max = x[i][0];