Skip to content

Instantly share code, notes, and snippets.

View benaskins's full-sized avatar
🍑
Peachy

Ben Askins benaskins

🍑
Peachy
View GitHub Profile
@benaskins
benaskins / README.md
Last active February 14, 2018 21:51
Create overview html file for Lattice goals

Run it like this

TOKEN=your_token ruby lattice.rb

It will produce a page.html which you can then open and paste into a Google Doc or something

You can get your token by snooping on the HTML requests in Chrome dev tools. It will be as part of the authorization request header in the form "Bearer {token}".

task :cache => :environment do
hydra = Typhoeus::Hydra.hydra
Site.all.each do |site|
fork do
Locality.each_url(site.webservice_connection) do |url|
req = # build request
hydra.queue
end
end
end
(function($) {
$.fn.extend({
pluginName: function(options) {
// Initialise the class
new PluginClass(this, $.extend({}, $.fn.pluginName.defaults, options));
// Return this for chaining
return this;
}
});
function GAImporter() {
this.busy = false;
this.poller = setInterval(this.pollJob, 5000);
this.pollJob = function() {
if (!this.busy) {
this.busy = true;
this.checkJob();
this.busy = false;
}
- if @items
- @items.collect { |item| item.gsub(/views\/.+\/(.+).haml/, '\1') }.each do |name|
- unless name == "index" || name[/^hide-/]
%p do some stuff
- @items.collect { |item| item.split("/").last.split(".").first }.each do |name|
- unless name == "index" || name.match(/hide-.+/)
%p do some stuff
<div class="formContainer">
<script type="text/javascript">
function activateConditionals() {
var from_load = arguments ? arguments[0] : false;
$('body').getElementsBySelector('conditional').each(function(e) {
eval(e.readAttribute('condition_change'));
});
}
# BONUS PARTY GAME - Choose 1 or make your own! Is this DRY gone mad?
# A
named_scope :leads, :conditions => ["dancers.lead = ?", true], :joins => :dancer
named_scope :follows, :conditions => ["dancers.lead = ?", false], :joins => :dancer
# B
[
[:leads, true],
[:follows, false]
@benaskins
benaskins / gist:34642
Created December 11, 2008 07:45 — forked from lachie/gist:34640
class Foo
attr_accessor :some_attr
def initialize(val)
self.some_attr = val
end
def hash
self.some_attr.hash
end
end