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 class Constellation_main { | |
public static void main(String[] args) { | |
System.out.println(getConstellationFromDate("10/01")); | |
} | |
private static String getConstellationFromDate(String strBirthday) { | |
int intBirthday = Integer.valueOf(strBirthday.replace("/","")); | |
if (intBirthday < 11 | intBirthday > 1231) { |
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('d3', []) | |
.factory('d3Service', ['$document', '$window', '$q', '$rootScope', | |
function($document, $window, $q, $rootScope) { | |
var d = $q.defer(), | |
d3service = { | |
d3: function() { return d.promise; } | |
}; | |
function onScriptLoad() { | |
// Load client in the browser | |
$rootScope.$apply(function() { d.resolve($window.d3); }); |
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
-- from http://stackoverflow.com/questions/132397/get-back-the-output-of-os-execute-in-lua | |
function os.capture(cmd, raw) | |
local f = assert(io.popen(cmd, 'r')) | |
local s = assert(f:read('*a')) | |
f:close() | |
if raw then return s end | |
s = string.gsub(s, '^%s+', '') | |
s = string.gsub(s, '%s+$', '') | |
s = string.gsub(s, '[\n\r]+', ' ') |
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
class Solution { | |
func fib(_ N: Int) -> Int { | |
return self.recursiveWay(N) | |
} | |
func recursiveWay(_ N: Int) -> Int { | |
if N == 0 { return 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
extension String { | |
public func isPhone()->Bool { | |
if self.isAllDigits() == true { | |
let phoneRegex = "[235689][0-9]{6}([0-9]{3})?" | |
let predicate = NSPredicate(format: "SELF MATCHES %@", phoneRegex) | |
return predicate.evaluate(with: self) | |
}else { | |
return false | |
} |
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
import UIKit | |
class NRLabel : UILabel { | |
var textInsets = UIEdgeInsets.zero { | |
didSet { invalidateIntrinsicContentSize() } | |
} | |
override func textRect(forBounds bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect { | |
let insetRect = UIEdgeInsetsInsetRect(bounds, textInsets) |
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
<div ng-app="wizardApp"> | |
<div ng-controller="WizardSignupController"> | |
<h2>Signup wizard</h2> | |
<div ui-view></div> | |
</div> | |
</div> | |
<script type="text/javascript" src="/js/vendor/angular-ui-router/release/angular-ui-router.min.js"></script> | |
<script type="text/javascript"> | |
angular.module('wizardApp', [ | |
'ui.router', |
This gist contains the source code in my video series about Realtime Database triggers. You can watch the three parts here:
index.ts
contains the Cloud Functions code, and dialog.ts
contains the script to run
OlderNewer