Skip to content

Instantly share code, notes, and snippets.

View meadhikari's full-sized avatar
🏠
Working from home

Bikram Adhikari meadhikari

🏠
Working from home
View GitHub Profile
button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
increaseSize();
} else if (event.getAction() == MotionEvent.ACTION_UP) {
resetSize();
}
}
};
button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
// the button is down monitor time to see how long it is down or anything you want
} else if (event.getAction() == MotionEvent.ACTION_UP) {
// the button is up reset your timer
}
}
};
import urllib2
import re
from lxml import html
def school_type(school_report):
import cStringIO
from lxml import etree
from BeautifulSoup import BeautifulSoup
import urllib2
import re
from lxml import html
@meadhikari
meadhikari / deactivate.ps1
Created February 20, 2015 09:18
Powershell script to deactivate user who have not logged in for 30 days
$connection = new-object System.Data.SqlClient.SQLConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=aspnetdb");
$cmd = new-object System.Data.SqlClient.SqlCommand("UPDATE dbo.aspnet_Membership SET IsApproved = 0 where LastLoginDate < DATEADD(DAY, -30, GETDATE())", $connection);
$connection.Open();
$reader = $cmd.ExecuteNonQuery()
$connection.Close();
Write-output $reader
@meadhikari
meadhikari / Readme.md
Last active August 29, 2015 14:19 — forked from EHadoux/Readme.md

Description

This is a dashing widget intended to show metrics from a sonar repository.

Usage

This widget currently uses the list widget as a view. You just have to add this snippet to your dashboard:

# Required metadata
sonar.projectKey=java-sonar-runner-hybris
sonar.projectName=HYBRIS
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=bin/custom
# Language
sonar.language=java
#!/usr/bin/env python
#Usage
#script.py -r <region name>(optional) -e <environment tagname> <action>[start|stop|status]
from optparse import OptionParser
import boto.ec2
def get_options():
global options
parser = OptionParser(usage="usage: %prog [options] start|stop|status", version="%prog 1.0")
@meadhikari
meadhikari / Must be a correct way
Created February 8, 2012 10:14
Javascript Novice Question
// this clearly is not the correct way of doing this, what must I be doing
pos1 = document.getElementById('pos1').value;
pos2 = document.getElementById('pos2').value;
pos3 = document.getElementById('pos3').value;
pos4 = document.getElementById('pos4').value;
pos5 = document.getElementById('pos5').value;
pos6 = document.getElementById('pos6').value;
pos7 = document.getElementById('pos7').value;
pos8 = document.getElementById('pos8').value;
pos9 = document.getElementById('pos9').value;
@meadhikari
meadhikari / gist:2015638
Created March 11, 2012 08:47
What am I doing wrong
We couldn’t find that file to show.