Skip to content

Instantly share code, notes, and snippets.

View graphnode's full-sized avatar
🐱
(^・ω・^ )

Diogo Gomes graphnode

🐱
(^・ω・^ )
  • Lisboa, Portugal
View GitHub Profile
@graphnode
graphnode / Program.cs
Created March 17, 2016 15:54
DllImport fail on native compilation.
using System;
using System.Runtime.InteropServices;
namespace ConsoleApplication
{
[StructLayout(LayoutKind.Sequential)]
public class OpenFileName
{
public int structSize;
public IntPtr dlgOwner = IntPtr.Zero;
1>------ Build started: Project: ZERO_CHECK, Configuration: Release Win32 ------
1> Checking Build System
1> CMake does not need to re-run because D:/Projects/CSFML-2.3/_build/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Projects/CSFML-2.3/_build/src/SFML/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Projects/CSFML-2.3/_build/src/SFML/All/CMakeFiles/generate.stamp is up-to-date.
2>------ Build started: Project: csfml-all, Configuration: Release Win32 ------
2> Building Custom Rule D:/Projects/CSFML-2.3/src/SFML/All/CMakeLists.txt
2> CMake does not need to re-run because D:\Projects\CSFML-2.3\_build\src\SFML\All\CMakeFiles\generate.stamp is up-to-date.
2> Clock.cpp
2>D:\Projects\CSFML-2.3\src\SFML\System\Clock.cpp(35): warning C4273: 'sfClock_create': inconsistent dll linkage
@graphnode
graphnode / dewormer.user.js
Last active October 25, 2021 20:56
Spacebattles & Sufficient Velocity DeWormer
// ==UserScript==
// @name Spacebattles & Sufficient Velocity DeWormer
// @namespace https://gist.github.com/graphnode/fbf9013d3eb589a9da52
// @version 1.3.0
// @description Hide threads based on a simple filter on some xenforo forums.
// @author Diogo Gomes <dgomes@graphnode.com>
// @match https://forums.spacebattles.com/*
// @match https://forums.sufficientvelocity.com/*
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using ProBuilder2.Math;
namespace ProBuilder2.Examples
{
@graphnode
graphnode / gist:53f8c58e520d5de59a9e
Created November 17, 2014 12:24
Parallel Email sending with throttling.
pyblic async Task SendEmailsWithThrottling(List<string> totalRecipientList, int throttle)
{
for(var i = 0; i < Math.Ceil(totalRecipientList.Count / throttle); i++)
{
var recipientList = totalRecipientList.Skip(i * throttle).Take(throttle);
var sendEmailTasks = recipientList.Select(async recipient =>
{
var message = new MailMessage { To = { recipient }, ... };
@graphnode
graphnode / config.js
Last active August 29, 2015 14:06
Show Not Found (404) page without changing URL using ui-router.
angular.module('Application', ['ui-router'])
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
// Create states for application plus on for the error state.
// Notice that the error state doesn't have url (but it can).
$stateProvider
.state('login', {
@graphnode
graphnode / gist:3247695
Created August 3, 2012 13:25 — forked from fxsjy/gist:3244607
Simple Memcached server in Javascript with 100 lines of code
/* Simple Memcached in Javascript
* @Author: Sun, Junyi
* @Email: ccnusjy@gmail.com
* @Date: 2012-8-3
*/
var net = require('net');
var store = {}
function handle_header(header, crlf_len){
var tup = header.split(" ")
@graphnode
graphnode / levenshtein.js
Created May 18, 2011 23:09
levenshtein function in javascript
function levenshtein(s1, s2) {
// http://kevin.vanzonneveld.net
// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
// + bugfixed by: Onno Marsman
// + revised by: Andrea Giammarchi (http://webreflection.blogspot.com)
// + reimplemented by: Brett Zamir (http://brett-zamir.me)
// + reimplemented by: Alexander M Beedie
// * example 1: levenshtein('Kevin van Zonneveld', 'Kevin van Sommeveld');
// * returns 1: 3
var sys = require('sys');
var http = require('http');
var time = (new Date).getTime();
var ep = http.createClient(80, "localhost");
http.createServer(function(ureq, ures) {
var request = ep.request('get', '/help/', {'host': "localhost"});
request.addListener('response', function(resp) {
ures.writeHead(200, resp.headers);
sys.pump(resp, ures, function() {
var sys = require('sys'),
http = require('http');
function requestGoogle(callback) {
var google = http.createClient(80, 'www.google.com');
var request = google.request('GET', '/', {'host': 'www.google.com'});
request.addListener('response', function (response) {
var data = "";
response.addListener('data', function (chunk) {