Skip to content

Instantly share code, notes, and snippets.

💭
10x Ninja Rockstar

Adam Loving adamloving

💭
10x Ninja Rockstar
Block or report user

Report or block adamloving

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
@clarkdave
clarkdave / pg_enum.rb
Last active Jul 18, 2019
basic support for PostgreSQL Enums in ActiveRecord - to be placed in an initializer
View pg_enum.rb
##
# This provides `create_enum` and `drop_enum` methods for migrations, which creates
# a Postgres ENUM type with the provided values.
#
# It'll also dump these into the schema.rb to be loaded into another DB (e.g. rake db:test:load)
#
# In order to reference the new enums as actual types, ActiveRecord needs to know about them, so
# make sure they are all represented in the `types` array below
#
# Then you can reference them in your migrations, e.g.
View btsync+backupsy.md

Auto Synchronized Backups with Bittorrent sync & a vps

1. Cloud syncing on the cheap

Two awsome things were released yesterday :

Compare this to the pricing of : dropbox pro

@adamloving
adamloving / tweet-this.js
Created Nov 25, 2012
Add "tweet this" links to text in a blog post
View tweet-this.js
function onMouseenter(e) {
el = $(e.target);
url = 'https://twitter.com/intent/tweet?text='
url += encodeURIComponent(el.text());
url += ' ' + window.location.href;
// el.css('position', 'relative');
el.append('<a href="' + url + '" target="_blank" class="tweet-this" style="position: relative; left: 5px;">Tweet this</a>');
};
function onMouseleave(e) {
@contra
contra / stuff.coffee
Created Apr 24, 2012
Tiny window.location parser javascript/coffee-script
View stuff.coffee
parseLocation = ->
out = {}
for key in window.location.search.substring(1).split "&"
pair = key.split "="
out[pair[0]] = pair[1]
return out
View gist:1793220
"""This is main.py, where the main stuff happens.
"""
import sys
import os
# lets assume your file is in /home/oli/nuke_files/main.py
#
# __file__ is a magic variable which python automatically populates, and is the
# full path to the file which is currently being executed (i.e. this one),
# so __file__ == '/home/oli/nuke_files/main.py'
@snatchev
snatchev / gist:1316470
Created Oct 26, 2011
resque worker devise not eager loading
View gist:1316470
❷ > QUEUE=* rake resque:work --trace
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:preload
rake aborted!
No such file to load -- devise/confirmations_controller
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:306:in `rescue in depend_on'
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:301:in `depend_on'
@harleyholt
harleyholt / example-if-template.html
Created Oct 20, 2011
Example of Knockout Conditionally Rendered Template
View example-if-template.html
<!-- Example one shows the most verbose way of specifying a template that is only rendered if someObject is defined in the current view model
This information was culled from https://github.com/SteveSanderson/knockout/blob/1.3/src/binding/defaultBindings.js#L445
-->
<script type="text/html" id="sub-example-one">
<h2 data-bind="text: title"></h2>
<p data-bine="text: description"></p>
</script>
<script type="text/html" id="example-one">
@exogen
exogen / watch
Created Sep 15, 2011
Generic file watcher script.
View watch
#!/bin/bash
#
# Author: Brian Beck <exogen@gmail.com>
# Usage: watch PATH COMMAND...
#
# This script watches PATH and runs COMMAND whenever PATH or a descendent
# of PATH is modified. COMMAND is everything after the first argument.
#
# If PATH is "-", then the list of paths comes from standard input.
#
@rweald
rweald / jammit.rake
Created Jun 1, 2011
Using Barista with Jammit to package and compile CoffeeScript
View jammit.rake
# simply run rake jammit:package to compile your coffeescript and then package up all your assets
# including the newly compiled javascripts
namespace :jammit do
task :package do
Rake::Task["barista:brew"].invoke
Jammit.package!
end
end
You can’t perform that action at this time.