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
| $(document).ready(function(){ | |
| $.get("https://reqres.in/api/users?page=1", function(data, status){ | |
| var item; | |
| $.each(data.data, function(index, obj) { | |
| item = ` | |
| <div class="card"> | |
| <img src=${obj.avatar} alt="Avatar" style="width:100%"> | |
| <div class="container"> | |
| <h4><b>${obj.first_name}</b></h4> |
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
| Intent shortcut = new Intent(getActivity(), MainActivity.class); | |
| shortcut.setAction(Intent.ACTION_MAIN); | |
| Intent add = new Intent(); | |
| add.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcut); | |
| add.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Your Activity Name"); | |
| add.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getActivity(), R.drawable.ic_clock)); | |
| add.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); | |
| getActivity().sendBroadcast(add); |
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 void buttonMerge() { | |
| Bitmap backGroundImage = BitmapFactory.decodeResource(getResources(), R.drawable.pinknblue); | |
| Bitmap foregroundImage = BitmapFactory.decodeResource(getResources(), R.drawable.pa); | |
| Bitmap mergedImages = createSingleImageFromMultipleImages(backGroundImage, foregroundImage); | |
| imageView.setImageBitmap(mergedImages); | |
| } | |
| private Bitmap createSingleImageFromMultipleImages(Bitmap firstImage, Bitmap secondImage){ |
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
| void saveAsImage(){ | |
| View content = getActivity().findViewById(R.id.rootLayout); | |
| content.setDrawingCacheEnabled(true); | |
| Bitmap bitmap = content.getDrawingCache(); | |
| File file = new File("/sdcard/" + "demo" + ".png"); | |
| try { | |
| if (!file.exists()) { | |
| file.createNewFile(); | |
| } | |
| FileOutputStream ostream = new FileOutputStream(file); |
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
| package com.example.niphin.childrengames; | |
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Canvas; | |
| import android.os.Bundle; | |
| import android.support.annotation.Nullable; | |
| import android.view.MotionEvent; |
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
| /* | |
| * Copyright (c) 2015 LingoChamp Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| from flask import Flask, request, jsonify, make_response | |
| from flask_sqlalchemy import SQLAlchemy | |
| import uuid | |
| from werkzeug.security import generate_password_hash, check_password_hash | |
| import jwt | |
| import datetime | |
| from functools import wraps | |
| app = Flask(__name__) |
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
| mkdir tutorial | |
| cd tutorial | |
| # Create a virtualenv to isolate our package dependencies locally | |
| virtualenv env | |
| source env/bin/activate # On Windows use `env\Scripts\activate` | |
| # Install Django and Django REST framework into the virtualenv | |
| pip install django | |
| pip install djangorestframework |
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
| private void udpReceive() { | |
| Thread thread = new Thread(new Runnable() { | |
| @Override | |
| public void run() { | |
| Log.i(TAG, "run: "); | |
| lMsg = new byte[1024]; | |
| DatagramPacket dp = new DatagramPacket(lMsg, lMsg.length); | |
| DatagramSocket ds = null; | |
| try { | |
| ds = new DatagramSocket(5005); |
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 paho.mqtt.client as mqtt | |
| from Crypto.Cipher import AES | |
| import json, thread,time | |
| MQTT_TOPIC_HOME = 'Raybaby' | |
| MQTT_BROKER = 'iot.eclipse.org' | |
| MQTT_PORT = 1883 | |
| sub_topic = "/stream/encrypt" |