Skip to content

Instantly share code, notes, and snippets.

View jnsprnw's full-sized avatar
🍊
Making smoothies

Jonas jnsprnw

🍊
Making smoothies
View GitHub Profile

Music for working, programming, reading, …

…sleeping, meditating, yoga, after hour…. Mostly ambient, drone, (neo-)classical, dub, minimal techno, deep house, micro house, downtempo, slo-mo house, ketapop, schneckno, jetlagdisco, post-rock, lowfi hip hop…

Please feel free to comment your recommendations.

Unicode/HTML characters

Striche

Sign Description Unicode Mac
Bindestrich U+2010
Gedankenstrich (Halbgeviertstrich) U+2013 ⌥ + -
Subtraktionszeichen (Minus) U+2212
Spiegelstrich (Geviertstrich) U+2014 ⇧ + ⌥ + -
Geschützer Bindestrich ‑ \2011
@jnsprnw
jnsprnw / .htaccess
Created March 20, 2017 09:17
HTACCESS to redirect all requests to root for React Router to handle them
<IfModule mod_rewrite.c>
RewriteEngine On
# redirect all to index
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ / [L,NC]
</IfModule>
{
"1": {
"name": "Fareedoone Aryan",
"id": 1,
"reports": [
"21"
],
"location": "Kabul",
"latitude": 34.555649,
"longitude": 69.205927,
@jnsprnw
jnsprnw / reformat.rb
Last active February 23, 2017 10:04
reformat csv files – delete unwanted columns, squeeze and strip columns, fill placeholders
#!/usr/bin/env ruby
require 'csv'
require 'awesome_print'
require 'json'
class Hash
def checkKeys!(allowed_keys)
self.keys.each { |key| delete(key) unless allowed_keys.include? key }
self
end
@jnsprnw
jnsprnw / readWriteCSV.rb
Created February 22, 2017 10:17
snippets for reading and writing csv files in ruby
def readCSV (file)
CSV.read(file, { encoding: "UTF-8", headers: true, header_converters: :symbol, converters: :all }).map { |d| d.to_hash }
end
def writeCSV (file, hash)
CSV.open(file, "w") do |row|
row << hash.first.keys
hash.each { |obj| row << obj.values }
end
end
@jnsprnw
jnsprnw / GeoDistance.rb
Created February 20, 2017 18:08
Calculate distance between two coordinates
#!/usr/bin/env ruby
class GeoDistance
R = 6371000
def toRadians (v)
return v * Math::PI / 180.0;
end
def calc (a, b)
company location
Adobe 151 Almaden Blvd, San Jose, CA 95113
Altera 101 Innovation Dr, San Jose, CA 95134
Apple 1 Infinite Loop, Cupertino, CA 95014
Applied Materials 3050 Bowers Ave, Santa Clara, CA 95054
Cisco 170 W Tasman Dr San Jose, CA 95134
eBay 2065 Hamilton Ave San Jose, CA 95125
Equinix 1 Lagoon Dr, Redwood City, CA 94065
Facebook 1601 Willow Road, Menlo Park, CA 94025
Google 1600 Amphitheatre Pkwy Mountain View, CA 94043
{
"p1": {
"id": 1,
"content": "photo",
"content_links": [
"http://placekitten.com/200/300"
],
"correspondent": "Hashmat Yousufzai",
"correspondent_id": 4,
"name": "Abdul Majeed Rouyee",