Skip to content

Instantly share code, notes, and snippets.

@danielgrippi
danielgrippi / embed_it.js
Created September 8, 2012 22:08
friend everyone!
javascript:(function(){
var s = document.createElement('script');
s.src = 'https://raw.github.com/gist/3680226/d605bdbd77927e426ad3939a20edf22caa517772/fe.js';
document.body.appendChild(s);
})();
@danielgrippi
danielgrippi / ogParse.js
Created August 31, 2012 22:46
grab json representation of a site's OG tags
function ogTags(nodes, nodeList) {
for(idx in nodeList)
if(validTag(nodeList[idx]))
nodes.push(nodeList[idx])
return nodes
}
function validTag(node) {
var attrs = node.attributes
return attrs && attrs.property && attrs.property.value.search(/og:*/) != -1
@danielgrippi
danielgrippi / initializationstuff.js
Created August 15, 2012 23:11
top-level value initialization with backbonejs
app.pages.GenericCanvas = app.pages.Base.extend({
initialize : function(opts){
if(opts)
/* use `this` as the destination object, so values
can be overridden and defaults can be supplied */
_.extend(this, {
pageTitle: opts.title,
pageDescription: opts.description,
@danielgrippi
danielgrippi / cleanup.rb
Created January 25, 2012 06:40
Remove excess share_visibilities from 1/24 HEAD
index = 0
while index < 1216623 do
puts index
sql = <<-SQL
DELETE sv
FROM share_visibilities AS sv
INNER JOIN posts
ON sv.shareable_id = posts.id
@danielgrippi
danielgrippi / unicorn.rb
Created January 24, 2012 22:36
unicorn config
rails_env = ENV['RAILS_ENV'] || 'development'
# Enable and set these to run the worker as a different user/group
#user = 'diaspora'
#group = 'diaspora'
worker_processes 1
## Load the app before spawning workers
#preload_app true
@danielgrippi
danielgrippi / .vimrc.local
Created January 20, 2012 20:31
dan's vimrc.local
set wildmode=full
set wildignore+=*/.git/*,*/log/*,*/.hg/*,*/.svn/*,*/.DS_Store,*/public/uploads/*
" NERDTree and Control-P remapping
map \ :NERDTreeToggle<CR>
nmap <Leader>t :CommandT<CR>
nmap <Leader>p :CtrlP<CR>
nmap <Leader>b :CtrlPBuffer<CR>
" Visual Indentation