Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@abrkn
abrkn / asset-embed.js
Created June 13, 2012 12:47
asset embedding for node.js
var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var debug = require('debug')('asset-embed');
module.exports = function() {
var self = {
loaders: {
less: function(a, callback) {
self.loaders.plain(a, function(err, res) {
@abrkn
abrkn / ScreenCapture.cs
Created July 23, 2012 09:41
Captures the specified region of the a window to a System.Drawing.Bitmap.
using System;
using System.Drawing;
using System.Runtime.InteropServices;
public static class ScreenCapture
{
class NativeMethods
{
[DllImport("user32.dll")]
internal static extern IntPtr GetWindowDC(IntPtr hWnd);
@abrkn
abrkn / gist:3755445
Created September 20, 2012 11:44
COFFEE-fied
App.Meta = Backbone.Model.extend(initialize: ->
# Locate tags and find current values.
@$titleTag = $("title")
@$titleTag = $("<title></title>").appendTo($("head")) unless @$titleTag.length
@$descriptionTag = $("meta[name=\"description\"]")
@$descriptionTag = $("<meta name=\"description\" content=\"\" />").appendTo("head") unless @$descriptionTag.length
@attributes.title = window.title or @$titleTag.text()
@attributes.description = @$descriptionTag.attr("content")
@attributes.rendered = false
this.socket.emit = _.wrap(this.socket.emit, function(fn, name) {
console.log.apply(this, ['-->', socket.id].concat(_.toArray(arguments).slice(1)));
return fn.apply(this, _.toArray(arguments).slice(1));
});
@abrkn
abrkn / gist:3937698
Created October 23, 2012 08:48
client (browser) side debug logging with socket.io
//not using console.log.apply because of compat *cough*ie*cough* issues)
this.socket.emit = _.wrap(this.socket.emit, function (fn, name, message) {
console.log('-->', name, _.toArray(arguments).slice(2));
return fn.apply(this, _.toArray(arguments).slice(1));
});
this.socket.$emit = _.wrap(this.socket.$emit, function (fn) {
console.log('<--', arguments[1], _.toArray(arguments).slice(2));
return fn.apply(this, _.toArray(arguments).slice(1));
});
var mongoose = require('mongoose')
, secrets = require('../secrets')
, monk = require('monk')
, db = monk(secrets.db)
, _ = require('underscore')
, users = db.get('users');
module.exports = db;
_.extend(users, {
{
"op": "utx",
"x": {
"hash": "28d2d7b5a470e5b2aaec60d49223ff513bfa5d4196d38326430ff5339c0e6762",
"vin_sz": 1,
"vout_sz": 2,
"lock_time": "Unavailable",
"size": 225,
"relayed_by": "5.9.24.81",
"tx_index": 31042853,
@abrkn
abrkn / gist:4016174
Created November 5, 2012 09:08
starryeyez
[09:25:39] <starryeyez> hey
[09:38:26] <abrkn> ok
[09:38:30] <abrkn> please do not fuck this up
[09:39:02] <starryeyez> k
[09:39:35] <abrkn> i will do it at 1.1*gox which is 10.70102 * 1.1 = 11.77 usd
[09:40:21] <abrkn> you need to send a PERSONAL PAYMENT and choose PAYMENT OWED
[09:40:34] <starryeyez> fair enough
[09:40:41] <abrkn> to ### EMAIL CENSORED ### for the amount 11.77
[09:41:08] <starryeyez> whats the most u could sell?
[09:41:21] <abrkn> one