Skip to content

Instantly share code, notes, and snippets.

// Post repeat directive for logging the rendering time
angular.module('myApp').directive('postRepeatDirective',
['$timeout',
function($timeout) {
return function(scope) {
if (scope.$first)
window.a = new Date(); // window.a can be updated anywhere if to reset counter at some action if ng-repeat is not getting started from $first
if (scope.$last)
$timeout(function(){
console.log("## DOM rendering list took: " + (new Date() - window.a) + " ms");
// Disable Context Menu
document.oncontextmenu = function () {
    return false
};

// Disable dragging of HTML elements
document.ondragstart = function () {
    return false
};
getReferrerTraits = function() {
// Requires: jQuery, jQuery.cookie, segment.io
// TODO: Update referralHost:blackList with your domain, so we only track external referrers.
var analytics_args = [],
analytics_traits,
acquisitionSource,
firstReferrer,
firstCampaign,
#!/usr/bin/python
'''
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
Correct PIN for hash and salt below is 1234.
Get 40-character hash value in ascii hex format from file /data/system/password.key on the phone
Get salt in signed numeric format by doing sqlite3 query SELECT value FROM locksettings WHERE name = 'lockscreen.password_salt' on /data/system/locksettings.db
.modal {
width: 800px;
left: 40%;
}
.lightbox-content {
width: 100%;
}
.lightbox-image {
@timelf123
timelf123 / bullet.js
Created December 11, 2013 18:16 — forked from d3noob/.block
(function() {
// Chart design based on the recommendations of Stephen Few. Implementation
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
// http://projects.instantcognition.com/protovis/bulletchart/
d3.bullet = function() {
var orient = "left", // TODO top & bottom
reverse = false,
duration = 0,
ranges = bulletRanges,
// Copyright 2012 Google Inc. All Rights Reserved.
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@timelf123
timelf123 / ga-ratio.js
Last active December 19, 2015 12:28 — forked from andrewrocco/ga-ratio.js
NOTE: This is developed for the "old" GA, not Universal Analytics Send devicePixelRatio info to GA
// NOTE: This is developed for the "old" GA, not Universal Analytics
// Create the test
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal";
// Pass it along through GA
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
// --- IMPORTANT LINE!
/*
* Asynchronous loading of ads.
* Below is of the top of my head rewrite to load multiple ads at the same time
* in a asynchronous fashion.
*
* I gave it a quick test run and it seems to work as fare as I can see
*
*
* var EpomConfig = EpomConfig || {ads : []};
* (function(){
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");