Skip to content

Instantly share code, notes, and snippets.

View rnrneverdies's full-sized avatar
👋
Working hard

Emanuel Vecchio rnrneverdies

👋
Working hard
View GitHub Profile
/*!
* JavaScript function to calculate the destination point given start point latitude / longitude (numeric degrees), bearing (numeric degrees) and distance (in m).
*
* Original scripts by Chris Veness
* Taken from http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens <http://mathiasbynens.be/>
* Based on the Vincenty direct formula by T. Vincenty, “Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations”, Survey Review, vol XXII no 176, 1975 <http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf>
*/
function toRad(n) {
return n * Math.PI / 180;
};
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@melanke
melanke / MLRoundedImageView.java
Created October 25, 2013 17:19
Android Rounded Image
public class MLRoundedImageView extends ImageView {
public MLRoundedImageView(Context context) {
super(context);
}
public MLRoundedImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@robdmoore
robdmoore / gist:f82d74d4c377d4f3755e
Created August 31, 2014 06:14
List all documents in an Azure DocumentDB Document Collection
class Program
{
static void Main(string[] args)
{
Task.WaitAll(new[] {DoStuff()});
}
private static async Task DoStuff()
{
var client = new DocumentClient(new Uri("https://<documentdbtenant>.documents.azure.com:443/"),
@addyosmani
addyosmani / package.json
Last active January 18, 2024 21:31
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
@m00nlight
m00nlight / gist:b3f7a4e4fb9ee9ddd1dd
Last active April 18, 2018 10:13
Python Knuth shuffle algorithm
def knuth_shuffle(items):
"""
Fisher-Yates shuffle or Knuth shuffle which name is more famous.
See <http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle> for detail
Type : [a] -> None (shuffle inplace)
Post constrain: Should be list
Post constrain: return array of the same length of input
"""
for i in range(len(items)):
@wmaurer
wmaurer / 0_DateTimeOffsetExtensions.cs
Last active August 16, 2017 22:43
Convert to and from Unix time
namespace Extensions
{
using System;
public static class DateTimeOffsetExtensions
{
public static DateTimeOffset FromUnixTimeSeconds(this long seconds)
{
var dateTimeOffset = new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
dateTimeOffset = dateTimeOffset.AddSeconds(seconds);
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active March 19, 2024 05:50
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@karpathy
karpathy / min-char-rnn.py
Last active May 6, 2024 16:42
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)