Skip to content

Instantly share code, notes, and snippets.

View maml's full-sized avatar
💭
build

Matthew Loseke maml

💭
build
  • Laurentide Ice Sheet
View GitHub Profile
command line fu from @fpolgardy
find . -name '*.sass'
and . . .
find . -name '*.sass' | xargs grep colors
@maml
maml / anonymous.js
Created February 28, 2012 23:53
jquery anonymous pattern?
$(function() {
var ghost = 'face';
function blah() {
// do shit . . .
}
});
@maml
maml / mi.js
Created February 29, 2012 00:03
method invocation
var mthdInvctnPtrn = {
init: function() {
// ^oh!
},
meth: function() {}
}
@maml
maml / git
Created March 30, 2013 00:55
If you want to commit on top of the current HEAD with the exact state at a different commit, undoing all the intermediate commits, then you can use reset to create the correct state of the index to make the commit.
# reset the index to the desired tree
git reset --hard 56e05fced (the sha you `want to go to there` to)
# move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
@maml
maml / UITableView+PreventEmptyCells
Created April 3, 2014 19:28
Category on UITableView that will prevent empty cells from rendering
// Put the following in a file called UITableView+PreventEmptyCells.h
#import <UIKit/UIKit.h>
@interface UITableView (PreventEmptyCells)
+ (void)preventEmptyRows:(UITableView *)tableView;
@end
+ (void)blurbWasLiked:(PFObject *)blurb byUser:(PFUser *)liker
{
/*
Query for blurb's user
*/
PFQuery *userQuery=[PFUser query];
PFUser *blurbUser = [blurb objectForKey:@"user"];
[userQuery whereKey:@"objectId" equalTo:blurbUser.objectId];
/*
@maml
maml / gist:1e30d1b821635fb69ab3
Created October 5, 2014 19:13
script tag for tincanapp.com
<script type="text/javascript" src="https://raw.github.com/edits-by-us/client/master/edits-by-us.min.js" id="js-edu-script-tag" data-selectors="#article-body" data-token="12c687b0-2ef1-0132-e700-20c9d07cae7b"></script>
var currentDate = new Date();
futureDate = new Date("March 17, 2015 21:00:00"); // page says launching from March 9th
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
jQuery('#basketballCountdownClock').FlipClock(diff, {
clockFace: 'DailyCounter',
countdown: true
});
# api docs say to submit . . .
{
'user_invitation_token' : 'xyz###',
'first_name' : 'John',
'last_name' : 'Appleseed',
'email' : 'john.appleseed@email.com',
'username' : 'john',
'password' : 'foobar',
'password_confirmation' : 'foobar'
}
@maml
maml / UIButton.swift
Created September 8, 2015 18:11
Adds some helper methods to UIButton for enabling, disabling, hiding, showing, and combinations thereof.
import UIKit
extension UIButton {
func disable() {
self.enabled = false
}
func enable() {