Skip to content

Instantly share code, notes, and snippets.

View agneym's full-sized avatar

Agney Menon agneym

View GitHub Profile
@agneym
agneym / MainActivity.java
Created January 27, 2016 06:17
Main Activity for Hello World Project - Android
package agney.alpha.com.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
package agney.alpha.com.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@agneym
agneym / activity_main
Created January 27, 2016 09:21
Layout of Main Activity - Hello World
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="agney.alpha.com.helloworld.MainActivity">
@agneym
agneym / MainActivity.java
Created January 29, 2016 07:33
Just another Button and Edit Text
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent (MainActivity.this ,DisplayActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE,message);
import MySQLdb
# Open database connection
db = MySQLdb.connect("localhost","root","","dbName" )
# prepare a cursor object using cursor() method
cursor = db.cursor()
# execute SQL query using execute() method.
cursor.execute("SELECT VERSION()")
@agneym
agneym / img_as_float.py
Created April 12, 2016 12:27
To represent opencv image as normalised float
import cv2
import numpy as np
from skimage import img_as_float
#Read image from given direcotory
image = cv2.imread('C:\Python27\images\pic.jpg')
#Print pixel at (100,100)
print image[100,100]
#................ image converted to float.............
.container {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
@agneym
agneym / javascriptreact.json
Last active October 26, 2020 21:56
VS Code JSX Snippets
{
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');"
],
"description": "Log output to console"
},
"Functional React Component": {
"prefix": "rfc",
@agneym
agneym / fibonacci.html
Last active February 3, 2018 18:35
Thengascript Examples.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="thengascript.js"></script>
@agneym
agneym / gist:0a1e2c7dc4671735504912f83b44cf67
Last active February 7, 2018 15:05
Convert hasClass to classes() codemod.
codemod "expect\((.*?)\.hasClass\(('.*?')\)\)\.to\.equal\(true\)" 'expect(\1.classes()).to.include(\2)'
codemod "expect\((.*?)\.hasClass\(('.*?')\)\)\.to\.equal\(false\)" 'expect(\1.classes()).to.not.include(\2)'
codemod "expect\((.*?)\.hasAttribute\(('.*?'),('.*?')\)\)\.to\.equal\(true\);" ''