Skip to content

Instantly share code, notes, and snippets.

@adamyanalunas
adamyanalunas / example.m
Created May 11, 2013 06:14
Stubbing PSPDFViewController
context(@"stubbing init/alloc", ^{
describe(@"can stub", ^{
__block PSPDFViewController *psVC;
__block PSPDFViewController *initVC;
beforeEach(^{
psVC = PSPDFViewController.alloc;
initVC = [psVC init];
[PSPDFViewController stub:@selector(alloc) andReturn:psVC];
@adamyanalunas
adamyanalunas / date_helper.coffee
Last active December 16, 2015 17:59
Sinon's time freezing is destroyed by Sugar.js
exports.DateHelper = {
lock: (msSinceEpoc) ->
# NOTE: Needed because Calendar model expects moment in the global scope.
global.moment = require('moment')
# NOTE: This can be removed once Sugar.js is removed
dateSugar = Date.SugarMethods
clock = sinon.useFakeTimers(msSinceEpoc)
# NOTE: This can be removed once Sugar.js is removed
Date[k] = v.method for k,v of dateSugar
@adamyanalunas
adamyanalunas / broker.js
Created November 9, 2012 20:43
Abstracting event names from broker calls
app.events = {
data: {
},
ui: {
main: {
channel: 'ui.main',
topics: {
layoutLoaded: 'layout.loaded'
@adamyanalunas
adamyanalunas / sdbw.css
Created October 23, 2012 05:37
Updates to make SDBW entries more readable
.ui-addtocal {
cursor: pointer; /* No need for cursor: hand; Nobody uses IE 5.5 any more */
position: absolute;
bottom: 10px;
right: 17px;
}
ol#eventsList h6.eventHost {
width: 220px
}
@adamyanalunas
adamyanalunas / jasmine.toBeTypeOf.js
Created October 21, 2012 01:14
jasmine.js matcher to test type of object
jasmine.Matchers.prototype.toBeTypeOf = function(expected) {
var actual, notText, objType;
actual = this.actual;
notText = this.isNot ? 'not ' : '';
objType = actual ? Object.prototype.toString.call(actual) : '';
this.message = function() {
return 'Expected ' + actual + notText + ' to be an array';
}
@adamyanalunas
adamyanalunas / clearField.js
Created September 15, 2012 00:05
Fix magic moving focus on franklabs.com/igs
function clearField(field)
{
if ( field && field.value )
field.value = '';
}
@adamyanalunas
adamyanalunas / dabblet.css
Created July 23, 2012 16:05 — forked from gentle-media/dabblet.css
CSS3 ribbon buttons
/**
* CSS3 ribbon buttons
*/
.ribbonA{
position: relative;
display: block;
width: 258px;
height: 50px;
font: .9em/50px Georgia, "Times New Roman", Times, serif;
@adamyanalunas
adamyanalunas / dabblet.css
Created February 4, 2012 02:04
A sublte button
/**
* A sublte button
*/
.btn:hover .inner {
background-position: 0 15px;
-webkit-transition: background-position .1s linear;
}