List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
| import imp | |
| import random | |
| import urllib.request | |
| import threading | |
| def generate_credit_card_number(): | |
| cc_number = [0] * 15 | |
| for i in range(15): | |
| cc_number[i] = random.randint(0, 9) |
| // chart data | |
| List expenses = [ | |
| {"name":"Groceries","amount":500.0}, | |
| {"name":"Online Shopping","amount":100.0}, | |
| {"name":"Eating out","amount":80.0}, |
| /// dart complete isolate example | |
| import 'dart:io'; | |
| import 'dart:async'; | |
| import 'dart:isolate'; | |
| Isolate isolate; | |
| void start() async { | |
| ReceivePort receivePort= ReceivePort(); //port for this main isolate to receive messages. |
| import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; | |
| import com.google.auth.oauth2.GoogleCredentials; | |
| import com.google.firebase.FirebaseApp; | |
| import com.google.firebase.FirebaseOptions; | |
| import com.google.firebase.messaging.FirebaseMessaging; | |
| import com.google.firebase.messaging.FirebaseMessagingException; | |
| import com.google.firebase.messaging.Message; | |
| import com.google.firebase.messaging.Notification; | |
| import org.junit.Before; | |
| import org.junit.Test; |
| const express = require('express') | |
| const multer = require('multer') | |
| const upload = multer() | |
| const app = express() | |
| var fs = require('fs'); | |
| app.post('/',upload.array('file',4),(req,res)=>{ | |
| req.files.forEach((file)=>{ | |
| console.log(file) |
| import 'package:http/http.dart' as http; | |
| import 'dart:io'; | |
| import 'package:http_parser/http_parser.dart'; | |
| import 'package:mime/mime.dart'; | |
| void main() async { | |
| var uri = Uri.parse('http://localhost:3000/'); | |
| var request = http.MultipartRequest('POST', uri ,); | |
| var path = File('b1.jpeg').path ; |
| app.post('/', async (req,res)=>{ | |
| try { | |
| const result = await app.dbUtil.db.collection('users').insertOne(req.body) | |
| res.json(result) | |
| } catch(error){ |
| import 'package:http/http.dart' as http; | |
| import 'dart:convert'; | |
| void main() async { | |
| var url = 'http://localhost:3000/'; | |
| var body = jsonEncode({ | |
| 'name' : 'Abood', | |
| 'Color' : 'blue' | |
| }); |
| import 'dart:math'; | |
| /// generate coordnates for cercomfrance | |
| void main(){ | |
| var radius = 100.0 ; | |
| var centerLat = 25.756037 ; | |
| var centerLon = 55.969354 ; |