Skip to content

Instantly share code, notes, and snippets.

@mretzak
mretzak / foundation-smaller-breakpoint.scss
Last active August 29, 2015 14:09
This introduces another breakpoint below 'small' screen as defaulted in foundation
// foundation_and_overrides.scss
$xsmall-screen: 400px;
$small-screen: 768px;
$medium-screen: 1280px;
$large-screen: 1440px;
// media query + column override
@media (max-width: #{$xsmall-screen}) {
@mretzak
mretzak / big_south_seq_reset.sql
Created March 19, 2014 14:06
Check and reset primary key sequence for Big South survey_question_options
-- find highest ID value
SELECT MAX(id) FROM survey_question_options;
-- check next value in auto-incrementing sequence
SELECT nextval('survey_question_options_id_seq');
-- if they are not in sync, reset sequence at highest ID + 1
SELECT setval('survey_question_options_id_seq', (SELECT MAX(id) FROM survey_question_options)+1);
@mretzak
mretzak / gist:8199244
Created December 31, 2013 16:35
Clear search class toggle on container
$scope.toggleClearSearch = function() {
if ($scope.filters.search == '') {
$('#search-form').removeClass('filtered');
}
else {
$('#search-form').addClass('filtered');
}
}
$scope.search = function() {
@mretzak
mretzak / Base2 Logon Log
Created April 2, 2013 18:35
Server log when attempting to login
Started POST "/logon" for 127.0.0.1 at 2013-04-02 14:34:55 -0400
Processing by LogonController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"RhpMFtuSrMrV6ZTYi24w2xHX65qa+NzDLKZZuD1k9lw=", "email"=>"fmorton@base2inc.com", "password"=>"[FILTERED]", "commit"=>"Logon"}
ContextOrganization Load (0.7ms) SELECT "context_organizations".* FROM "context_organizations" WHERE ((server_names like '%localhost%')) LIMIT 1
Person Load (198.6ms) SELECT "people".* FROM "people" INNER JOIN "context_organizations" ON "context_organizations"."id" = "people"."context_organization_id" WHERE (((email like 'fmorton@base2inc.com@%') or (email='fmorton@base2inc.com'))) AND (((length(password_hash)>'0') or (password_hash is not null))) AND (((length(password_salt)>'0') or (password_salt is not null))) AND (((context_organization_id is not null) and (context_organization_id>0))) ORDER BY context_organizations.name
Redirected to http://localhost:3000/logon
Completed 302 Found in 205ms (ActiveRecord: 199.3ms)
@mretzak
mretzak / index.html
Created March 19, 2013 20:21
A CodePen by mretzak. Off-Canvas With Twitter Bootstrap - The following is a general example of how to get Twitter bootstrap to have an off-canvas layout. To tryout simply begin shrinking your browser.
<div class="container" id="main">
<div class="row-fluid" style="
margin-bottom: 10px;">
<p class="span12">
<a href="#menu" class="side-menu-link btn btn-mini" title="Click for sub-menu">
<i class="icon-th"></i>
</a>
</p>
</div>
@mretzak
mretzak / gist:3988459
Created October 31, 2012 17:22
YouTube embed in UIWebview
NSString *embedHTML = @"\
<html><head>\
<meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 620\"/></head>\
<script>document.ontouchmove = function(event) {event.preventDefault();}</script>\
<body style=\"background:#000;margin:0px;\">\
<div><iframe width=\"620\" height=\"348\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\" allowfullscreen></iframe>\
</div></body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, url];
@mretzak
mretzak / gist:3152809
Created July 20, 2012 19:44
Bookmarklet for Firebug Lite 1.3
javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E=F[i+'NS']&&F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('script');E[r]('id',b);E[r]('src',I+g+T);E[r](b,u);(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);E=new%20Image;E[r]('src',I+L);})(document,'createElement','setAttribute','getElementsByTagName','FirebugLite','3','releases/lite/1.3/firebug-lite.js','releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#startOpened');
@mretzak
mretzak / webkit-orientation-change.js
Created March 23, 2012 18:19
Adjust viewport info on device rotate to correctly respond to media queries
<script type="text/javascript">
(function(doc) {
var addEvent = 'addEventListener',
type = 'gesturestart',
qsa = 'querySelectorAll',
scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
function fix() {
# This code will take the raw source text from a tweet and add appropriate links to #hastags, @ replies, and links. The ugly stuff in there is dealing with various formats of html character codes
def to_html
self.text.gsub("&amp;","&").gsub(/(http:\/\/([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?)/,'<a href="\1" target="_blank" rel="nofollow">\1</a>').gsub(/@(\w+)/,'@<a href="http://twitter.com/\1" target="_blank" rel="nofollow">\1</a>').gsub(/&#/,"~begonia~~").gsub(/#(\w+)/,' #<a href="http://twitter.com/#search?q=%23\1" target="_blank" rel="nofollow">\1</a>').gsub(/~begonia~~/,"&#")
end