Skip to content

Instantly share code, notes, and snippets.

@D1plo1d
D1plo1d / package.json
Last active September 5, 2015 21:20
Frig + React + Webpack Starter Pack
{
"name": "resume",
"version": "0.0.1",
"private": true,
"dependencies": {
"coffee-script": "1.9.3",
"webpack": "*",
"webpack-dev-server": "*",
"css-loader": "*",
"style-loader": "*",
module HardDestroyCallbacks
extend ActiveSupport::Concern
included do
define_callbacks :hard_destroy
around_destroy :run_hard_destroy_callbacks
def run_hard_destroy_callbacks
return yield unless deleted_at.present?
@D1plo1d
D1plo1d / push_and_dont_save.rb
Created April 3, 2014 21:58
push_and_dont_save.rb
module ActiveRecord
module Associations
class HasManyAssociation < CollectionAssociation
# Pushes a model into the association but does not save it to the database
def push_and_dont_save(record)
@target.push record
set_owner_attributes(record)
set_inverse_instance(record)
end
@D1plo1d
D1plo1d / SelfSignedHttpsAgent.coffee
Last active August 29, 2015 13:57
SelfSignedHttpsAgent
tls = require "tls"
https = require "https"
http = require "http"
net = require "net"
_ = require "lodash"
# This HTTPS Agent allows us to verify a server's self-signed cert before
# accepting the connection via a "cert" event that is emitted when the cert
# is received.
module.exports = class SelfSignedHttpsAgent extends https.Agent
@D1plo1d
D1plo1d / gist:8909401
Created February 10, 2014 02:32
opencv error
brew install -v opencv --env=std
/usr/bin/env python -c import numpy
/usr/bin/env python -c import numpy
==> Downloading https://github.com/Itseez/opencv/archive/2.4.7.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/opencv-2.4.7.1.tar.gz
==> Verifying opencv-2.4.7.1.tar.gz checksum
tar xf /Library/Caches/Homebrew/opencv-2.4.7.1.tar.gz
==> Patching
/usr/bin/patch -g 0 -f -p1 -i 000-homebrew.diff
patching file cmake/OpenCVFindOpenNI.cmake
# vim: ai:et:sts=2:ts=2:sw=2
require "sugar"
exports.config =
# See http://brunch.readthedocs.org/en/latest/config.html for documentation.
modules:
definition: false
wrapper: false
paths:
public: "_public/"
files:
has one call pattern, but the limit is 0
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$wa{v Xvwv} [lid]'
has one call pattern, but the limit is 0
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$wa{v svoh} [lid]'
@D1plo1d
D1plo1d / gist:6109626
Created July 30, 2013 02:09
Prontserve 0.3 Output (captured using construct_hello_world.py)
> python2.7 construct_hello_world.py
--- request header ---
GET /socket?user=admin&password=admin HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: localhost:8888
Origin: http://localhost:8888
Sec-WebSocket-Key: LR+C4adrS+SkvJuOgSkElQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol:construct.text.0.3
@D1plo1d
D1plo1d / gist:6016494
Created July 17, 2013 00:18
Adam's prontserve error
MemoryError
ERROR:tornado.access:500 POST /jobs?session_uuid=3bb02608-94ce-45cf-be5a-cd2c54f6ae37 (192.168.111.74) 6528.38ms
message received: get_jobs
eption
raise_exc_info((type, value, traceback))
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "prontserve.py", line 126, in read_chunks
self.request._on_request_body(''.join(self.chunks), self.uploaded)
File "/usr/lib/python2.7/site-packages/tornado/httpserver.py", line 465, in _on_request_body
@D1plo1d
D1plo1d / gist:5882593
Created June 28, 2013 05:09
construct protocol websocket header
Cache-Control:no-cache
Connection:Upgrade
Host:192.168.111.111:8888
Origin:http://192.168.111.111:8888
Pragma:no-cache
Sec-WebSocket-Extensions:x-webkit-deflate-frame
Sec-WebSocket-Key:4ILv8kQMb/Te+yOXUeectA==
Sec-WebSocket-Protocol:construct.text.0.0.1
Sec-WebSocket-Version:13
Upgrade:websocket