Skip to content

Instantly share code, notes, and snippets.

@morsdyce
morsdyce / analyticsController.js
Last active August 29, 2015 14:23
Google social sign in directive #angular #directive #google #social
$scope.$on('event:google-plus-signin-success', function (event, authResult) {
// Send login to server or save into cookie
$scope.showLoader = true;
if (authResult && authResult['code']) {
$http.post('/setup/authorize', { code: authResult['code'] }).then(function () {
$http.get('/setup/getaccounts').then(function (response) {
$scope.signedIn = true;
$scope.data.accounts = response.data;
$scope.showLoader = false;
});
@morsdyce
morsdyce / .aliases
Created July 6, 2015 11:08
OSX Bluetooth Fix alias #osx #bluetooth #alias
#restart the bluetooth controller
restartBluetooth() {
sudo -v
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
}
alias bluetooth-reset=restartBluetooth
@morsdyce
morsdyce / gist-reveal.it-slides.html
Last active August 29, 2015 14:25 — forked from ryanj/gist-reveal.it-slides.html
Use Docker, gist.github.com, and Reveal.js to produce themed slideshow presentations for conferences and / or hackathons
<section data-background-transition='zoom' data-transition='concave' data-background='http://ryanjarvinen.com/presentations/shared/img/broadcast_reveal_dark.png' data-state='blackout'>
<h2>Gist-Powered</h2>
<h1>Reveal.js</h1>
<h2>Slideshow Presentations</h2>
<p class='fragment'><small><a class='fragment' href='http://github.com/ryanj/gist-reveal.it'>github.com/ryanj/gist-reveal.it</a>
<br/> <a class='fragment' href='https://registry.hub.docker.com/u/ryanj/gist-reveal.it/'>registry.hub.docker.com/u/ryanj/gist-reveal.it</a></small></p>
</section>
<section data-background-transition='zoom' data-transition='linear'>
<h2>Embed</h2>
<iframe webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" sandbox="allow-forms allow-scripts allow-popups allow-same-origin allow-pointer-lock" data-src="https://regex101.com/r/sB4uZ3/1"></iframe>
@morsdyce
morsdyce / if_env.js
Created September 23, 2015 16:21
If-env angular directive
export function ifEnv(ENV) {
return {
restrict: 'A',
priority: 600,
transclude: 'element',
terminal: true,
link: function(scope, element, attrs, ctrl, $transclude) {
if (ENV === attrs.ifEnv) {
$transclude(function (clone) {
element.after(clone);
@morsdyce
morsdyce / what-forces-layout.md
Created September 28, 2015 10:42 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@morsdyce
morsdyce / milestone_leadmachine.html
Created April 9, 2012 10:53
Milstone Leadmachine Implemenation
<!--
add the leadmachine javascript to ALL pages on the site (so it can track cookies across the entire site)
<script type="text/javascript" src="http://operad.net/lm.js?lang=en">
// Operad LeadMachine tracker.
</script>
-->
@morsdyce
morsdyce / adva.html
Created September 5, 2012 18:44
Adva
<div class="pic_wrapper">
<a href="http://twiter.co.il/ramimeiri/seminar/%d7%a6%d7%99%d7%91%d7%95%d7%a8-%d7%95%d7%97%d7%99%d7%a0%d7%95%d7%9a/">
<div class="pic">
<img width="287" height="173" src="http://twiter.co.il/ramimeiri/wp-content/uploads/ציבור-וחינוך-287x173.jpg" class="attachment-portfolio-3-column wp-post-image" alt="ציבור וחינוך" title="ציבור וחינוך">
</div>
</a>
<div class="pop_description1">
<a href="http://twiter.co.il/ramimeiri/seminar/%d7%a6%d7%99%d7%91%d7%95%d7%a8-%d7%95%d7%97%d7%99%d7%a0%d7%95%d7%9a/" title="ציבור וחינוך">
<img src="http://twiter.co.il/ramimeiri/wp-content/themes/cleancreative-theme/images/icon_zoom.png" alt="">
</a>
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new SparkViewFactory());
<h2>BookList</h2>
<% foreach (var book in Model) { %>
<div>
Book Id: <%:book.Id%>
Book Author: <%:book.Author%>
Book Name: <%:book.Name%>
</div>
<% } %>
public static class AccountValidation
{
public static string ErrorCodeToString(MembershipCreateStatus createStatus)
{
// See http://go.microsoft.com/fwlink/?LinkID=177550 for
// a full list of status codes.
switch (createStatus)
{
case MembershipCreateStatus.DuplicateUserName:
return "Username already exists. Please enter a different user name.";