Skip to content

Instantly share code, notes, and snippets.

View levelsio's full-sized avatar

levelsio levelsio

View GitHub Profile
@levelsio
levelsio / canggu.geojson
Created August 25, 2019 12:52
canggu.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#
# Building an MVP?
# Need a quick database you can set up in seconds?
# What about JSON?
#
# by @levelsio (with help from @marckohlbrugge, @oskarth, @maxdeviant and @kumailht)
# JS
db=[]
fs=require('fs')
@levelsio
levelsio / ip_limiter.php
Created April 24, 2019 08:29
MAKE book IP limiter (req'd by @rashidi_life)
#
// check if customer hash correct
loadDbs(array('customers'));
$query=$customersDb->prepare("SELECT * FROM customers WHERE secret_hash=:secret_hash");
$query->bindValue(':secret_hash',$_GET['hash']);
$query->execute();
$customers=$query->fetchAll(PDO::FETCH_ASSOC);
$customer=$customers[0];
if(!empty($customer) && $customers[0]['secret_hash']==$_GET['hash']) {
<?
// <readme>
/*
This is a lite version of Olark's and Intercom's functionality (without the chat part).
It lets you get feedback from users on your site to your email.
And you won't have to rely on another company anymore!
#killyourdependencies
@levelsio
levelsio / windows_keys_like_osx.ahk
Last active November 12, 2019 10:08
Make Bootcamp Windows keys act like OSX
; Make Bootcamp Windows keys act like OSX
; by @levelsio
;
; 2017-11-02
;
; Licensed as GPL
;
; Use autohotkey.com to load this file on Windows
;
; This fixes Cmd+Tab to work like Alt+Tab, also keys like Cmd+C as Ctrl+C etc., Cmd+Q to Alt-F4
function updateSlug() {
if(
$('.filters .filter.month .choice.active').length>0 &&
$('.filters .filter.region .choice.active').length>0
) {
slug='';
}
firstTemperatureDoneAlready=false;
# Copy this URL and add it as a bookmark, then open Google Maps, go to a place, and click it to open Hoodmaps at the same location
# by @marckohlbrugge
javascript:(function()%7Bvar%20parts%20%3D%20window.location.href.split(%22%40%22)%5B1%5D.split(%22%2C%22)%3Bwindow.location%20%3D%20%60https%3A%2F%2Fhoodmaps.com%2Findex.php%3Flatitude%3D%24%7Bparts%5B0%5D%7D%26longitude%3D%24%7Bparts%5B1%5D%7D%26zoom%3D%24%7Bparts%5B2%5D.replace(%22z%22%2C%20%22%22)%7D%60%7D)()
@levelsio
levelsio / malaysia_singapore.geojson
Last active December 13, 2018 18:30
Singapore + Malaysia country borders in GeoJSON because most are missing Singapore!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?
// this bot tries to match chat messages to previous forum posts and links to them
require_once(__DIR__.'/../app/config.php');
require_once(__DIR__.'/../app/functions.php');
loadDbs(array('users_global','messages','questions'));
@levelsio
levelsio / Is it now Ramadan.php
Last active June 6, 2018 01:58
"Is it now Ramadan?" function in PHP
# by @levelsio
#
# MIT licensed
#
# make sure you enable php_intl on PHP
# you can do by uncommenting ;extension=intl or ;extension=php_intl
# and installing php-intl, e.g. sudo apt-get install php-intl
#
# made for Nomad List to give people a notice if they go to a place
# where it is currently Ramadan