Skip to content

Instantly share code, notes, and snippets.

View typeoneerror's full-sized avatar
🤠
iOS, Capacitor, Ember, Vue, Rails

Benjamin Borowski typeoneerror

🤠
iOS, Capacitor, Ember, Vue, Rails
View GitHub Profile
class PagesController < ApplicationController
before_filter :authenticate
caches_page :home, :privacy
# Show the home page.
def home; end
# Show the privacy policy page.
@typeoneerror
typeoneerror / screen.css
Created November 10, 2011 20:24
isotope transition disable
.isotope.no-transition,
.isotope.no-transition .isotope-item,
.isotope .isotope-item.no-transition {
-webkit-transition-duration: 0s;
-moz-transition-duration: 0s;
transition-duration: 0s;
}
require 'yaml'
asset_path = File.expand_path(File.dirname(__FILE__) + '/../lib/assets/content/')
assets = Dir.glob(asset_path + '/*.yml')
assets.each do |url|
key = File.basename(url, '.yml')
parsed = YAML.load_file(url)
if parsed
klass = Admin.const_get(key.classify)
module AdminHelper
def link_to_direction(field, title = nil)
title ||= field.humanize
dir = @order_dir.downcase == 'asc' ? 'desc' : 'asc'
link_to title, yield(:order => field, :dir => dir) if block_given?
end
end
= link_to_direction('name') {|params| admin_artists_path(params)}
class Result < ActiveRecord::Base
class << self
def past_week_span(date = nil)
date ||= Date.today
(date.beginning_of_week...date.beginning_of_week + 7).collect do |date|
date.day
end
end
end
end
@typeoneerror
typeoneerror / count.sql
Created December 2, 2011 02:06
count of results per day of last week
SELECT
EXTRACT(DAY FROM created_at) AS the_day,
COUNT(created_at) AS count_all
FROM "results"
WHERE "results"."result_type" = 'outcome'
AND (DATE("results"."created_at") BETWEEN '2011-11-21' AND '2011-12-01')
GROUP BY created_at
ORDER BY created_at
#my
select code,id from reactions group by code;
#pg
select distinct on (code) code,id from reactions;
// test for fixed positioning
Modernizr.addTest("positionfixed", function()
{
// OK since iOS 5
//if (navigator.userAgent.match(/AppleWebKit\/(.*)Mobile\//)) return false;
if (navigator.userAgent.match(/Android(.*)Mobile/)) return false;
var test = document.createElement("div"),
control = test.cloneNode(false),
fake = false,
NSMutableAttributedString *attrStr = [NSMutableAttributedString attributedStringWithString:@"Text to kern"];
[attrStr addAttribute:(NSString *)kCTKernAttributeName
value:[NSNumber numberWithInt:-1]
range:NSMakeRange(0, [attrStr length])];
[self.introLabel setAttributedText:attrStr];
NSMutableAttributedString *attrStr = [NSMutableAttributedString attributedStringWithString:content];
range = NSMakeRange(0, [attrStr length]);
[attrStr setFont:[UIFont fontWithName:LBFontBryantMedium size:16]];
[attrStr setTextAlignment:CTTextAlignmentFromUITextAlignment(UITextAlignmentLeft)
lineBreakMode:CTLineBreakModeFromUILineBreakMode(UILineBreakModeWordWrap)];
[attrStr addAttribute:(NSString *)kCTKernAttributeName
value:[NSNumber numberWithFloat:-0.4]
range:range];
[attrStr addAttribute:(NSString *)kCTParagraphStyleAttributeName