Skip to content

Instantly share code, notes, and snippets.

View NeerajMoudgil's full-sized avatar

Neeraj Moudgil NeerajMoudgil

  • Chandigarh,India
View GitHub Profile
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
</head>
<body>
<div id="pi" class="alert alert-primary">
<b>Today is <u><label id='today'></label></u></b>
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body> <py-script> print('Hello, World! python here') </py-script> </body>
</html>
@NeerajMoudgil
NeerajMoudgil / DetectingAugImg.java
Last active August 20, 2018 11:57
Detecting augmented Image
//adding listener to ARfragment
arFragment.getArSceneView().getScene().addOnUpdateListener(this::onUpdateFrame);
private void onUpdateFrame(FrameTime frameTime){
Frame frame = arFragment.getArSceneView().getArFrame();
Collection<AugmentedImage> augmentedImages = frame.getUpdatedTrackables(AugmentedImage.class);
for (AugmentedImage augmentedImage : augmentedImages){
if (augmentedImage.getTrackingState() == TrackingState.TRACKING){
@NeerajMoudgil
NeerajMoudgil / MainActivity.java
Last active August 20, 2018 11:49
Adding Image to AugmentedIamgeDatabase
//config can be intiated using new Config(session) where session is arfragment scene session
private boolean setupAugmentedImageDb(Config config) {
AugmentedImageDatabase augmentedImageDatabase;
Bitmap augmentedImageBitmap = loadAugmentedImage();
if (augmentedImageBitmap == null) {
return false;
}
augmentedImageDatabase = new AugmentedImageDatabase(mSession);
augmentedImageDatabase.addImage("car", augmentedImageBitmap);
config.setAugmentedImageDatabase(augmentedImageDatabase);
@NeerajMoudgil
NeerajMoudgil / activity_main.xml
Last active August 20, 2018 06:57
Adding Arfragment to xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".MainActivity">
<fragment android:name="com.google.ar.sceneform.ux.ArFragment"
android:id="@+id/ar_fragment"
android:layout_width="match_parent"
@NeerajMoudgil
NeerajMoudgil / MyApplication.java
Created July 20, 2018 05:20
application class to check android app is in foreground or background
public class MyApplication extends Application implements LifecycleObserver
{
private static Context appContext;
public static boolean wasInBackground;
@Override
public void onCreate()
{
super.onCreate();
appContext=this;