Skip to content

Instantly share code, notes, and snippets.

View hippietrail's full-sized avatar

Andrew Dunbar hippietrail

  • Phong Nha
  • 11:59 (UTC +07:00)
View GitHub Profile
From 32339a202769c7474ee51c82cf4703cec67dbbc5 Mon Sep 17 00:00:00 2001
From: Mark Chandler <mark@moddb.com>
Date: Mon, 30 Aug 2010 20:40:59 -0700
Subject: [PATCH] Fixes bug when offset is over 32bits but node.js returns -1 instead of correct offset
---
src/node_file.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/node_file.cc b/src/node_file.cc
@nichtich
nichtich / wiktionarylookup.html
Created November 12, 2010 19:10
Look up a word in Wiktionary via MediaWiki API and show the Wiktionary page
<html>
<head>
<script type="text/javascript" src="./jquery-1.4.3.min.js"></script>
<script type="text/javascript">
var baseURL = 'http://en.wiktionary.org';
function showPage(page,text) {
var sourceurl = baseURL + '/wiki/' + page;
$('#pagetitle').text(page);
$('#wikiInfo').html(text);
$('#sourceurl').attr('href',sourceurl);
@TooTallNate
TooTallNate / .gitignore
Created July 9, 2011 04:05
low-level objc runtime apis
*
!*.m
!Makefile
@mathiasbynens
mathiasbynens / unsafeWindow.user.js
Created August 13, 2011 13:21
`unsafeWindow` polyfill (for use in user scripts)
// ==UserScript==
// @name Emulate `unsafeWindow` in browsers that don’t support it.
// ==/UserScript==
// http://mths.be/unsafewindow
window.unsafeWindow || (
unsafeWindow = (function() {
var el = document.createElement('p');
el.setAttribute('onclick', 'return window;');
return el.onclick();
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@elmer-garduno
elmer-garduno / stripgutenberg.pl
Created July 25, 2012 15:51 — forked from hippietrail/stripgutenberg.pl
Strip headers/footers from Project Gutenberg texts
#!/usr/bin/perl
# stripgutenberg.pl < in.txt > out.txt
#
# designed for piping
# Written by Andrew Dunbar (hippietrail), released into the public domain, Dec 2010
# Added some other patterns to the beginning and header states
use strict;
@hippietrail
hippietrail / ht-search-related-tags.user.js
Last active October 11, 2015 04:57
Add a "Related Tags" module to the sidebar for Search results
@Eng-Fouad
Eng-Fouad / SampleMingw.kt
Created July 9, 2019 22:38
Kotlin Native Win32 GUI Sample
package sample
import kotlinx.cinterop.*
import platform.windows.*
@ExperimentalUnsignedTypes
fun WndProc(hwnd: HWND?, msg: UINT, wParam: WPARAM, lParam: LPARAM) : LRESULT
{
// This switch block differentiates between the message type that could have been received. If you want to
// handle a specific type of message in your application, just define it in this block.
@WilliamD47
WilliamD47 / save.swift
Created August 30, 2021 20:54
Save NSImage to file macOS SwiftUI
func savePNG(image: NSImage, path:String) {
let imageRep = NSBitmapImageRep(data: image.tiffRepresentation!)
let pngData = imageRep?.representation(using: .png, properties: [:])
do {
try pngData!.write(to: URL(fileURLWithPath: path))
} catch {
print(error)
}
@dovahkiin98
dovahkiin98 / AutoSizeText.kt
Created October 4, 2021 09:03
AutoSize text implementation in Jetpack Compose
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.InternalFoundationTextApi
import androidx.compose.foundation.text.TextDelegate
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier