Skip to content

Instantly share code, notes, and snippets.

View maskaravivek's full-sized avatar
💭
Active!

Vivek Kumar Maskara maskaravivek

💭
Active!
View GitHub Profile
@maskaravivek
maskaravivek / Bollywood Jalwa song Scrapper
Created March 23, 2014 16:57
Code to scrap songs from bollywood jalwa and save it in a MYSQL database.
<?php
$album="Single Track";
$category="pop";
$letters=range('A', 'Z');
include('config.php');
include('simple_html_dom.php');
for($l=20;$l<26;$l++)
{
$ur="http://wap.bollywoodjalwa.com/home.php?dir=Ringtones/Mp3/MP3-Hollywood_Mp3/Hollywood-".$letters[$l]."&p=0&page=1&sort=1";
$htm= file_get_html($ur);
@maskaravivek
maskaravivek / Extract quotes from goodreads
Created March 28, 2014 15:24
This php code uses simple_html_dom to scrap quotes along with their authors from Goodreads to a MYSQL database.
<?php
include('config.php');
include('simple_html_dom.php');
if(!empty($_POST['name']) && !empty($_POST['number']))
{
$cat=$_POST['name'];
$no=$_POST['number'];
for($i=1;$i<$no;$i++)
{
$url="http://www.goodreads.com/quotes/tag/".$cat."?page=".$i;
@maskaravivek
maskaravivek / Custom textbox style resource in windows phone
Created March 29, 2014 09:04
XAML code to edit textbox style in windows phone app
<phone:PhoneApplicationPage.Resources>
<local:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<Style x:Key="HeaderedContentControlHeaderStyle" TargetType="ContentControl">
<Setter Property="Foreground" Value="{StaticResource PhoneSubtleBrush}"/>
<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style x:Key="TextBoxHeaderStyle" BasedOn="{StaticResource HeaderedContentControlHeaderStyle}" TargetType="ContentControl">
<Setter Property="Padding" Value="0,0,0,8"/>
</Style>
@maskaravivek
maskaravivek / Copy reference database to isolated storage
Created April 1, 2014 14:19
This method simply moves the referenced database from the windows phone's project folder to the application's isolated storage
public static void MoveReferenceDatabase()
{
// Obtain the virtual store for the application.
IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();
// Create a stream for the file in the installation folder.
using (Stream input = Application.GetResourceStream(new Uri("DutchMe.sdf", UriKind.Relative)).Stream)
{
// Create a stream for the new file in the local folder.
using (IsolatedStorageFileStream output = iso.CreateFile("DutchMe.sdf"))
@maskaravivek
maskaravivek / Excel Uploader usage
Last active August 29, 2015 13:58
Excel Uploader usage
<?php
include 'simplexlsx.class.php';
include 'config.php';
$xlsx = new SimpleXLSX('ringtones.xlsx');
$excel = array(array());
$excel = $xlsx->rows();
for($i=1;$i<sizeof($excel);$i++){
$name = $excel[$i][0];
<?php
/*
SimpleXLSX php class v0.6.8
MS Excel 2007 workbooks reader
Example 1:
$xlsx = new SimpleXLSX('book.xlsx');
print_r( $xlsx->rows() );
Example 2:
@maskaravivek
maskaravivek / App.xaml
Last active August 29, 2015 13:58
Function to validate email address
<Style x:Key="TokkriHeaderStyle" TargetType="ContentControl">
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource TokkriTheme}"/>
<Setter Property="Margin" Value="0,4,0,4"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style x:Key="TokkriTextBox" TargetType="telerikPrimitives:RadTextBox">
<Setter Property="HeaderStyle" Value="{StaticResource TokkriHeaderStyle}"/>
<Setter Property="Height" Value="108"/>
<?php
error_reporting(-1);
//rest of php code
?>
@maskaravivek
maskaravivek / location.cs
Created April 17, 2014 14:13
How to check whether location is enabled on windows phone device? http://wtuts.me/LocationEnabled
public void locationfinder()
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
GeoCoordinateWatcher g = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
g.Start();
if (g.Permission == GeoPositionPermission.Denied)
{
App.phonelocationenabled = false;
// then we know it is off, else we assume it is on
@maskaravivek
maskaravivek / custom_message_box.cs
Created April 17, 2014 14:39
Using custom message box in windows phone app
CustomMessageBox msg=new CustomMessageBox()
{
Caption="Location Settings",
Message="Location seems to be disabled on your device. Do your want to change your settings?",
LeftButtonContent="yes",
RightButtonContent="no"
};
msg.Dismissed += (s1, e1) =>
{
switch (e1.Result)