Skip to content

Instantly share code, notes, and snippets.

View consoledotblog's full-sized avatar

consoledotblog

View GitHub Profile
@consoledotblog
consoledotblog / 2fa_1.cs
Last active August 29, 2015 13:57
Two Factor Authentication for the masses
DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
long counter = GetCurrentTCounter();
private long GetCurrentTCounter()
{
long seconds = (long)DateTime.UtcNow.Subtract(baseTime).TotalSeconds;
return seconds / interval;
}
@consoledotblog
consoledotblog / responsive_transclusion.html
Last active August 29, 2015 13:57
AngularJS - Responsive Transclusion
<!-- Simple directive template -->
<!-- This will always be hidden -->
<div class="sampleDirectiveTemplate" ng-if="false">
<!-- ng-src will never be processed and the image won't download -->
<img ng-src="pic.png" />
</div>
@consoledotblog
consoledotblog / AppDelegate.m
Last active August 29, 2015 13:57
How to Share View Controllers for iPhone and iPad Using Nibs for Reuse and Portability
#import "SLMainViewController.h"
//Java
public class HelloWorld {
public static void main(String[] args){
System.out.println("Hello, world!");
}
}
- (void)setImageWithURL:(NSURL *)url;
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage;
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example Blog</title>
<link rel="import" href="../components/core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../components/core-toolbar/core-toolbar.html">
<link rel="import" href="../components/core-icon-buttons/core-icon-buttons.html">
<link rel="import" href="../components/core-card/core-card.html">
</head>
<!doctype HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example Blog</title>
</head>
<body>
<h1>My Blog Entry</h1>
<small>by: John Smith</small>
object TestObject extends TestTraitClass {
val immutableVariable: String = "Hello Immutable"
var mutableVariable: String = "Hello Mutable"
def getImmutable(): String = immutableVariable
def getMutable(): String = {
mutableVariable
}
@consoledotblog
consoledotblog / amdefine.js
Last active August 29, 2015 14:09
Cross Platform CoffeeScript and RequireJS
if (typeof define !== 'function') { var define = require('amdefine')(module) }
@consoledotblog
consoledotblog / run-ansible.sh
Created October 26, 2015 22:45 — forked from pb8226/run-ansible.sh
Packer and Ansible Commands
ansible-playbook -i ansible-inventory.ini provision-server-playbook.yml