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
# The "query" configuration is adapted from this gist: https://gist.github.com/techniq/4609063 | |
.directive 'remoteSelectPlugin', ['$http', ($http) -> | |
{ | |
restrict: 'A' | |
link: (scope, elem, attr) -> | |
angular.element(elem).select2({ | |
placeholder: attr.remoteSelectPlugin | |
minimumInputLength: 1 | |
query: (options) -> |
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
app.directive 'selectPlugin', [ -> | |
{ | |
restrict: 'A' | |
link: (scope, elem, attr) -> | |
angular.element(elem).select2 { placeholder: attr.selectPlugin } | |
} | |
] |
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
app = angular.module 'AppAuth', [] | |
app.factory 'AuthService', ['$http', 'Session', 'AuthToken', ($http, Session, AuthToken) -> | |
{ | |
login: (username, password) -> | |
$http.post('api/v1/users/login/', { | |
username: username | |
password: password | |
}).then (response) -> | |
AuthToken.set(response.data.records.privateKey) if response.data._meta.status == 'SUCCESS' |
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
// Generated by CoffeeScript 1.7.1 | |
(function() { | |
var app = angular.module('AppAuth', []) | |
app.config([ | |
'$httpProvider', function($httpProvider) { | |
//Intercept all Out-Going HTTP Requests | |
$httpProvider.interceptors.push("AuthInterceptor"); | |
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
<?php | |
/** | |
* Return 1 if $Z can be expressed as on integer raised to the power of another integer | |
*/ | |
function superPower( $Z) { | |
$half = (int) sqrt($Z); | |
for ($x=2; $x<$half; $x++) { | |
if ($Z % $x == 0) { |
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
angular.module 'myModule', [] | |
.factory 'inputsWatcher', ( $interval ) -> | |
INTERVAL_MS = 500 | |
handlers = [] | |
execHandlers = -> | |
for handler in handlers | |
handler() | |
registerInput: (handler) -> |
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 OORadialGradientView | |
// Only override drawRect: if you perform custom drawing. | |
// An empty implementation adversely affects performance during animation. | |
- (void)drawRect:(CGRect)rect { | |
// Drawing Code | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
// Draw A Gradient from yellow to Orange | |
NSArray *colors = [NSArray arrayWithObjects:(id)[UIColor yellowColor].CGColor, (id)[UIColor orangeColor].CGColor, nil]; | |
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
'use strict'; | |
var AWS = require('aws-sdk'), | |
crypto = require('crypto'), | |
createS3Policy, | |
getExpiryTime; | |
getExpiryTime = function () { | |
var _date = new Date(); | |
return '' + (_date.getFullYear()) + '-' + (_date.getMonth() + 1) + '-' + | |
(_date.getDate() + 1) + 'T' + (_date.getHours() + 3) + ':' + '00:00.000Z'; |
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
function encodeImage(imageUrl, callback) { | |
var URL = require('url'), | |
sURL = imageUrl, | |
oURL = URL.parse(sURL), | |
http = require('http'); | |
var request = http.request({method:'GET', path:oURL.pathname, host: oURL.hostname, port:80}); | |
request.end(); | |
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
<?php | |
declare(strict_types = 1); | |
/** | |
* @author Oladapo Omonayajo <[email protected]> | |
* Created on 3/27/2017, 18:21 | |
*/ | |
namespace App\Http\Middleware; |
OlderNewer