Skip to content

Instantly share code, notes, and snippets.

@rust-play
rust-play / playground.rs
Created October 27, 2019 13:42
Code shared from the Rust Playground
use std::rc::Rc;
#[derive(Debug)]
struct Foo {
bar: usize,
}
impl Foo {
fn rc(bar: usize) -> Rc<Self> {
Rc::new(Foo { bar })
@azizur
azizur / Creating a static copy of a dynamic website.md
Last active May 25, 2024 16:06
Creating a static copy of a dynamic website

The command line, in short…

wget -k -K -E -r -l 10 -p -N -F --restrict-file-names=windows -nH http://website.com/

…and the options explained

  • -k : convert links to relative
  • -K : keep an original versions of files without the conversions made by wget
  • -E : rename html files to .html (if they don’t already have an htm(l) extension)
  • -r : recursive… of course we want to make a recursive copy
  • -l 10 : the maximum level of recursion. if you have a really big website you may need to put a higher number, but 10 levels should be enough.
@TabsPH
TabsPH / Main.java
Created November 25, 2012 08:12
Simple Web Browser
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author Alvin Tabontabon
@indigoexcel
indigoexcel / HTML: 404error
Created November 25, 2012 04:41
HTML: 404 Error
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
@GengGao
GengGao / gist:4142363
Created November 25, 2012 04:10
jQuery: Scroll to Top
$("a[href='#top']").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
@cassiano-gists
cassiano-gists / gist:4141404
Created November 24, 2012 21:08
JS: PubSub Paul Irish
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
// Usage
$(document.body).on( 'click', function() {