Skip to content

Instantly share code, notes, and snippets.

@stuwilli
stuwilli / gist:9580481
Created March 16, 2014 09:10
How to Floor, Round, Ceiling in JSTL/EL
Floor(N) -> ${N-(N%1)}
Ceiling(N) -> ${N+(1-(N%1))%1}
Round(N) -> ${N+((N%1>0.5)?(1-(N%1))%1:-(N%1))}
@stuwilli
stuwilli / gist:1a4d503f6e8db523540e77f381990cb9
Created July 6, 2016 13:49 — forked from jacqui/gist:983051
Redis SORT command examples
# Optimized for writes, sort on read
# LVC
redis.hset("bonds|1", "bid_price", 96.01)
redis.hset("bonds|1", "ask_price", 97.53)
redis.hset("bonds|2", "bid_price", 95.50)
redis.hset("bonds|2", "ask_price", 98.25)
redis.sadd("bond_ids", 1)
redis.sadd("bond_ids", 2)
{
"ecmaVersion": 5,
"libs": [
"browser",
"jquery"
],
"plugins": {
"complete_strings": {},
"node": {},
"lint": {},
# This file is sourced by /etc/init.d/sabnzbdplus
#
# When SABnzbd+ is started using the init script, the
# --daemon option is always used, and the program is
# started under the account of $USER, as set below.
#
# Each setting is marked either "required" or "optional";
# leaving any required setting unconfigured will cause
# the service to not start.
(function() {
function getFrame() {
if (!document.getElementById('akami-research-frame')) {
var iframe = document.createElement('iframe');
iframe.id = 'akami-research-frame';
iframe.src = 'about:blank';
iframe.style.width = '1px';
@stuwilli
stuwilli / NSLogCheatSheet.m
Created August 21, 2012 19:24
NSLog Cheat Sheet
NSLog(@"%@", songTitle);
NSLog(@"%@", songDuration);
NSLog(@"%f", [songDuration floatValue]);
NSLog(@"%d", [songDuration integerValue]);
@stuwilli
stuwilli / AppDelegate.m
Created August 19, 2012 20:45
Core Data App Delegate sample config
@implementation WSAppDelegate
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize managedObjectContext = _managedObjectContext;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSManagedObjectContext *context = [self managedObjectContext];
Names *name = [NSEntityDescription insertNewObjectForEntityForName:@"Names" inManagedObjectContext:context];
@stuwilli
stuwilli / gist:3395000
Created August 19, 2012 13:58 — forked from happy-coding/gist:3363334
Core Data AppDelegate Code
#pragma mark - Core Data stack
- (NSManagedObjectContext *)managedObjectContext
{
if (_managedObjectContext != nil) {
return _managedObjectContext;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator != nil) {
@stuwilli
stuwilli / mraid-image-splash-template.html
Created September 18, 2015 14:54
MRAID Splash Screen Template
<script src="mraid.js"></script>
<style>
body {
background: black;
margin: 0;
padding: 0;
}
#advert {
width: 640px;
}
@stuwilli
stuwilli / gist:483e94de00b762ab1ba4
Last active September 18, 2015 10:40
GPT Resize Freewheel Frame
<!--nosandbox-->
<div id='div-gpt-ad-1234567891234-728x90'></div><!-- change this elements id so it's unique -->
<script type="text/javascript">
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement("script");
gads.async = true;
gads.type = "text/javascript";
var useSSL = "https:" == document.location.protocol;