This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin scaffolding-with-border($borderSize) { | |
@for $i from 1 through 12 { | |
.span#{$i} { | |
width: 60px * $i + (20px * ($i - 1)) - $borderSize*2; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Devise | |
module Models | |
module AggregateAuthenticatable | |
extend ActiveSupport::Concern | |
STRATEGIES = {:basic => Devise::Models::DatabaseAuthenticatable, :ldap => Devise::Models::LdapAuthenticatable} | |
MODULES = [Devise::Models::DatabaseAuthenticatable, Devise::Models::LdapAuthenticatable] | |
module ClassMethods | |
def strategy_instance_methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@weakify(self); | |
[[RACAble(self.device.LEDBrightness) | |
distinctUntilChanged] | |
subscribeNext:^(NSNumber *LEDBrightness) { | |
@strongify(self); | |
[self updateUI]; | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void findInjector() { | |
EventListener[] eventListeners = context.getServletContext().getContextHandler().getEventListeners(); | |
for (EventListener eventListener : eventListeners) { | |
if (eventListener instanceof ApplicationServletContextListener) { | |
injector = ((ApplicationServletContextListener) eventListener).backDoorToInjector(); | |
break; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void startJetty() throws Exception { | |
configureServerProperties(); | |
configureServer(); | |
configureWebAppContext(); | |
configureWebAppDeployer(); | |
server.addLifeCycle(webAppDeployer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Collatz Sequence (http://en.wikipedia.org/wiki/Collatz_conjecture) | |
chain :: (Integral a) => a -> [a] | |
chain 0 = error "Zero will recurse forever" | |
chain 1 = [1] | |
chain x | |
| even x = x:chain (x `div` 2) | |
| odd x = x:chain (x*3 + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSDateFormatter(Extensions) | |
+ (NSDateFormatter *)apiFriendlyDateFormatter { | |
static NSDateFormatter *_utcFormatter; | |
if (!_utcFormatter) { | |
_utcFormatter = [[NSDateFormatter alloc] init]; | |
NSLocale *enUSPOSIXLocal = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]; | |
[_utcFormatter setLocale:enUSPOSIXLocal]; | |
[_utcFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT: 0]]; | |
[_utcFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map' :: (a -> b) -> [a] -> [b] | |
map' _ [] = [] | |
map' f xs = [f a | a <- xs] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import System.Environment | |
type Triangle = (Int, Int, Int) | |
perimeter :: Triangle -> Int | |
perimeter (a, b, c) = a + b + c | |
rightTriangle :: Triangle -> Bool | |
rightTriangle (a, b, c) = a^2 + b^2 == c^2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import System.Environment | |
type Triangle = (Int, Int, Int) | |
rightTriangles :: [Triangle] -> [Triangle] | |
rightTriangles xs = [ x | x@(a, b, c) <- xs, let rightTriangle = a^2 + b^2 == c^2, rightTriangle] | |
withMultipleOf :: [Triangle] -> Int -> [Triangle] | |
withMultipleOf xs m = [x | x@(a, b, c) <- xs, let perimeter = a + b + c, mod perimeter m == 0] |