Skip to content

Instantly share code, notes, and snippets.

View waynesutton's full-sized avatar

Wayne Sutton waynesutton

View GitHub Profile
@robbiet480
robbiet480 / directions_example.html
Created September 1, 2011 07:30
This HTML file contains Javascript code to detect location and redirect to Google Maps. Useful to tell people when they call asking for directions "go to http://robbiet.us/directions/" and it will auto direct them based on Geolocation. Uses Modernizr
<!DOCTYPE html>
<html>
<head>
<title>Directions Example</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js"></script>
<script type="text/javascript">
//Ask for HTML5 geolocation, use Modernizr to detect if we can even do it. If allow, go to show_map, if deny go to handle_error. Please note the High Accuracy flag, which may cause the location fix to take longer, but it gives a more precise reading
function get_location() {
if (Modernizr.geolocation) {
navigator.geolocation.getCurrentPosition(show_map, handle_error, {maximumAge: 75000, enableHighAccuracy: true});
@mhammonds
mhammonds / HideMobileAddressBar.js
Created September 3, 2011 03:23
Hide Browser Address Bar - Android + iPhone
function hideAddressBar()
{
if(!window.location.hash)
{
if(document.height < window.outerHeight)
{
document.body.style.height = (window.outerHeight + 50) + 'px';
}
setTimeout( function(){ window.scrollTo(0, 1); }, 50 );
@jasonclark
jasonclark / booklist.css
Last active May 6, 2019 05:52
booklist CSS - display as table row
<style type="text/css">
.items {display:table;list-style:none;margin:0;padding:0;border-spacing:5px;}
.items li {display:table-row;border-radius:10px;border:1px solid #ccc;padding:5px;margin:0 0 10px 0;}
.items li img {display:table-cell;vertical-align:top;}
.items li span.meta {display:table-cell;vertical-align:top;margin:0;padding:0 0 0 5px;}
.items li {margin:0 0 5px 0;}
</style>
@ndarville
ndarville / business-models.md
Last active February 27, 2025 10:00
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@mhawksey
mhawksey / functions.php
Created May 13, 2013 14:39
Snippet to add intercom.io code to your wordpress theme functions.php
<?php
function add_intercom() {
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
?>
<script id="IntercomSettingsScriptTag">
window.intercomSettings = {
@niallsmart
niallsmart / copy-checklist.js
Last active December 28, 2023 00:10
Copy Trello checklist to clipboard
copy($(".checklist-item:not(.checklist-item-checked)").map(function() {
var e = $(this),
item = e.find(".checklist-item-details-text").text()
if (e.hasClass("checklist-item-state-complete")) {
item = item + " (DONE)"
}
return item
}).get().join("\n"))
@JamalLyons
JamalLyons / stackpost.md
Last active November 21, 2024 02:00
Convex TypeGen StackPost Draft

Building Type-Safe Rust Applications with Convex: Introducing convex-typegen

thum2

If you've been following the backend-as-a-service landscape, you've likely heard of Convex. This innovative platform has been turning heads by offering a unique combination of developer experience, serverless functions, and real-time subscriptions, all wrapped in a developer-friendly package. What makes Convex particularly interesting is that under the hood, it's powered by Rust – a language choice that speaks volumes about its commitment to performance and reliability.

Speaking of Rust, it's fascinating to see how this systems programming language has found its way into backend development. While traditionally associated with low-level programming, Rust has become increasingly popular for building backend services, and for good reason. Its zero-cost abstractions, memory safety gua