Skip to content

Instantly share code, notes, and snippets.

@manniru
manniru / doors-ice.jpg
Created July 11, 2019 23:15 — forked from duhaime/doors-ice.jpg
Three.js Image Overlay
doors-ice.jpg
@manniru
manniru / geo.js
Created August 5, 2019 13:15 — forked from mkhatib/geo.js
A Javascript utility function to generate number of random Geolocations around a center location and in a defined radius.
/**
* Generates number of random geolocation points given a center and a radius.
* @param {Object} center A JS object with lat and lng attributes.
* @param {number} radius Radius in meters.
* @param {number} count Number of points to generate.
* @return {array} Array of Objects with lat and lng attributes.
*/
function generateRandomPoints(center, radius, count) {
var points = [];
for (var i=0; i<count; i++) {
export default function handle(req, res) {
res.end('Hello World');
}
@manniru
manniru / database.js
Created July 22, 2019 22:46 — forked from bag-man/database.js
Connect and use MongoDB with ES6 in Node 4
'use strict'
const MongoClient = require('mongodb')
class Database {
constructor (uri) {
this.uri = uri
this.db = {}
return this
@manniru
manniru / README.md
Created July 22, 2019 21:39 — forked from rantav/README.md
MongoDB increment or insert

In mongodb it's easy to make at upsert, meaning update-or-insert by calling

db.collection.update({criteria}, {updated fields}, true)

The third parameter means - insert a new document if the document doesn't exist yet. So, for example, the following will insert a new document for the user if there's no document for that user yet, and will update it if it already exists:

 db.users.update({user_id: '1234'}, {user_id: '1234', name: 'Ran'}, true)
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import clsx from "clsx";
import Card from "@material-ui/core/Card";
import CardHeader from "@material-ui/core/CardHeader";
import CardMedia from "@material-ui/core/CardMedia";
import CardContent from "@material-ui/core/CardContent";
import CardActions from "@material-ui/core/CardActions";
import Collapse from "@material-ui/core/Collapse";
import Avatar from "@material-ui/core/Avatar";
https://www.techdrivein.com/2010/12/15-nice-and-simple-open-source-android.html
http://gree.github.io/pure2d/
@xaadu
xaadu / hello.html
Last active May 1, 2024 12:50
Ostad | Python, Django, React | Batch 1 | Module 1 | Session 1
<!DOCTYPE html>
<html>
<head>
<title>This is a title</title>
<style>
.div1 {
border: 5px solid red;
text-align: center;
@manniru
manniru / databaseService.php
Created August 16, 2019 08:30 — forked from WengerK/databaseService.php
Drupal 8 - Print raw SQL queries for debugging
<?php
/**
* Debugging using the database connection.
*/
/** @var \Drupal\Core\Database\Connection */
$connection = \Drupal::service('database');
$query = $connection->select('node', 'node');
$query->fields('node', ['nid'])
@manniru
manniru / ContactForm-basic.php
Created August 16, 2019 08:29 — forked from WengerK/ContactForm-basic.php
Drupal 8 — Inline validation in forms
<?php
/**
* @file
* Contains \Drupal\my_contact\Form\ContactForm.
*/
namespace Drupal\my_contact\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;