Skip to content

Instantly share code, notes, and snippets.

View igstan's full-sized avatar

Ionuț G. Stan igstan

View GitHub Profile

Here's a struct in C:

struct Point
{
  int x;
  int y;
} ;

Given a variable p0 which is typed as struct Point:

@remy
remy / details.js
Created April 18, 2010 22:28
Add <details> support - includes stylesheet
/**
* Note that this script is intended to be included at the *end* of the document, before </body>
*/
(function (window, document) {
if ('open' in document.createElement('details')) return;
// made global by myself to be reused elsewhere
var addEvent = (function () {
if (document.addEventListener) {
return function (el, type, fn) {
# PHPUnit recipe for kicker
require 'osx/cocoa'
recipe :phpunit do
process do |files|
execute "phpunit"
end
end
# take control of the growl notifications

finger_server.js

An extremely minimal implementation of the Finger protocol using node.js.

To run (Finger uses port 79 which requires sudo):

sudo node finger_server.js
{-# LANGUAGE DoRec #-}
module ExprLang where
import Control.Monad.Error
import Data.List
import Data.Maybe
-- Language
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
open System
type Cont<'T> =
abstract Call<'R> : ('T -> 'R) * (exn -> 'R) -> 'R
let protect f x cont econt =
let res = try Choice1Of2 (f x) with err -> Choice2Of2 err
match res with
| Choice1Of2 v -> cont v
| Choice2Of2 v -> econt v
@wrwills
wrwills / smtp.hs
Created October 18, 2010 13:31
mime-mail + HaskellNet
import Network.Mail.Mime
import qualified Data.ByteString.Lazy.UTF8 as LU
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString as S
import Control.Monad
import qualified HaskellNet.SMTP as HN
import Text.Pandoc
import Text.Hamlet
import Text.XHtml.Transitional hiding ( renderHtml )
@simonw
simonw / varnish-jsonp.vcl
Last active May 13, 2021 18:13
Get Varnish to handle JSON-P requests for you
backend default {
.host = "127.0.0.1";
.port = "8000";
}
# We go BACK to varnish to get it to generate an ESI template that
# generates a JSON-P response.
backend jsonp_template_backend {
.host = "127.0.0.1";
.port = "8070";
@briandealwis
briandealwis / gist:782862
Created January 17, 2011 13:55 — forked from spullara/gist:782523
One-liner to turn jar with Main-Class into executable shell script
# turn a jar with a Main-Class into a stand alone executable
(echo '#!/usr/bin/env java -jar'; cat blahblah.jar) > blah
# turn a jar with a particular main clas into a stand alone executable
(echo '#!/usr/bin/env java -jar package.MainClass'; cat blahblah.jar) > blah