This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void setListViewHeightBasedOnChildren(ListView listView) | |
{ | |
ListAdapter listAdapter = listView.getAdapter(); | |
if(listAdapter == null) return; | |
if(listAdapter.getCount() <= 1) return; | |
int desiredWidth = MeasureSpec.makeMeasureSpec(listView.getWidth(), MeasureSpec.AT_MOST); | |
int totalHeight = 0; | |
View view = null; | |
for(int i = 0; i < listAdapter.getCount(); i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.Menu; | |
import android.view.MenuInflater; | |
import android.content.Context; | |
import android.support.v7.view.menu.MenuBuilder; | |
public class StringUtils { | |
/* | |
* Usage: String[] mMenuItems = StringUtils.getArrayFromMenu(this, R.menu.menu_main); | |
* And then mDrawerList.setAdapter(new ArrayAdapter<>(this, R.layout.item_listview_drawer, mMenuItems)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JS Version | |
var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', | |
randomString = '' | |
for (var i = 0; i < length; i++) { | |
var randomPos = Math.floor(Math.random() * charSet.length) | |
randomString += charSet.substring(randomPos, randomPos + 1) | |
} | |
return randomString |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
remote="$1" | |
url="$2" | |
message=$(git log -1 HEAD --pretty=format:%s) | |
public_repo="/Users/Moz/Desktop/public" | |
[ -d lang ] && yes | cp -rf lang/* $public_repo/lang | |
[ -d updates ] && yes | cp -rf updates/* $public_repo/updates | |
cd $public_repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install heroku toolbelt | |
Moz at Saifurs-MacBook-Pro in ~/Desktop | |
$ brew install heroku | |
==> Downloading http://assets.heroku.com.s3.amazonaws.com/heroku-client/heroku-c | |
######################################################################## 100.0% | |
/usr/local/Cellar/heroku-toolbelt/3.21.4: 449 files, 3.5M, built in 17 seconds | |
// Create an app | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="dropdown dropdown-fixed"> | |
<button | |
id="parentDropdown" | |
type="button" | |
class="btn btn-default oc-icon-mobile" | |
data-toggle="dropdown"> | |
<?php echo $variants[$this -> variant_id] ?> <?php if (count($variants) > 1): ?><span class="caret"><?php endif ?> | |
</button> | |
<?php if (count($variants) > 1): ?> | |
<ul class="dropdown-menu" role="menu" data-dropdown-title="Select variant"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="control-toolbar"> | |
<?php if (count($variants) == 0): ?> | |
<div class="toolbar-item callout fade in callout-danger"> | |
<div class="form-control content" style="padding: 10px 20px 10px;"> | |
<p>You must create at least one app with one variant to see values in this section.</p> | |
</div> | |
</div> | |
<?php else: ?> | |
<div class="toolbar-item toolbar-primary"> | |
<div id="dropdown-variant" data-control="toolbar"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Mohsin\Mobile\Controllers; | |
use Cookie; | |
use BackendMenu; | |
use Backend\Classes\Controller; | |
use Mohsin\Mobile\Models\Variant; | |
/** | |
* Installs Back-end Controller | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.Map.*; | |
import java.text.DecimalFormat; | |
/** | |
* Makes a longer number shorter like cr., lac, etc. | |
* Output: 500, 4k, 30k, 99k, 2lac, 9.9lac, 40lac, 99lac, 1.9Cr., 20Cr., 100Cr., 214Cr | |
* Limitation: Works from zero to the longest int or as Indians call, the Mallya limit. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<option class="ajax-area-search-li form-control" value="1" outlet_id="8" area_name="ASHOK NAGAR" area_id="1">AS | |
HOK NAGAR</option> | |
<option class="ajax-area-search-li form-control" value="2" outlet_id="8" area_name="AUSTIN TOWN" area_id="2">AU | |
STIN TOWN</option> | |
<option class="ajax-area-search-li form-control" value="3" outlet_id="8" area_name="BASAPPA ROAD" area_id="3">BA | |
SAPPA ROAD</option> | |
<option class="ajax-area-search-li form-control" value="5" outlet_id="8" area_name="BRIGADE ROAD" area_id="5">BR |