Skip to content

Instantly share code, notes, and snippets.

Andreas Brekken abrkn

Block or report user

Report or block abrkn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View popular.js
@abrkn
abrkn / asset-embed.js
Created Jun 13, 2012
asset embedding for node.js
View asset-embed.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 Jul 23, 2012
Captures the specified region of the a window to a System.Drawing.Bitmap.
View ScreenCapture.cs
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);
View gist:3755445
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
View gist:3937588
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 Oct 23, 2012
client (browser) side debug logging with socket.io
View gist:3937698
//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));
});
View gist:3970781
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, {
View gist:3979674
{
"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,
View gist:4016174
[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
You can’t perform that action at this time.