Skip to content

Instantly share code, notes, and snippets.

View gerzhan's full-sized avatar

Nikolay Gerzhan gerzhan

View GitHub Profile
@gerzhan
gerzhan / directive.js
Created January 12, 2016 09:13 — forked from DarrylD/directive.js
ionic slide box dynamic height - fixes the issue where the slide boxes aren't taking up the full height of the device
app.directive('dynamicHeight', function() {
return {
require: ['^ionSlideBox'],
link: function(scope, elem, attrs, slider) {
scope.$watch(function() {
return slider[0].__slider.selected();
}, function(val) {
//getting the heigh of the container that has the height of the viewport
var newHeight = window.getComputedStyle(elem.parent()[0], null).getPropertyValue("height");
if (newHeight) {
@gerzhan
gerzhan / cmd.bat
Created January 11, 2016 05:32
ANSICON v 1.6.6 "ConEmu blocks ANSICON injection" fix
rem go to the 64-bit binaries
cd whatever\x64
rem exclude the known problem DLLs - perhaps there are later versions of these as well?
set ANSICON_EXC=nvd3d9wrap.dll;nvd3d9wrapx.dll
rem start a new cmd with a logging ansicon
ansicon -l3
rem start a 32-bit cmd
%systemroot%\syswow64\cmd
rem now it crashes?
ansicon -u
@gerzhan
gerzhan / lodashSortSpec.js
Created January 3, 2016 03:41 — forked from tlimpanont/lodashSortSpec.js
Testing _. lodash sortBy function for grid list view
describe('_.sortBy of lodash',function(){
var descData = [
{title: "B", number: 2, date: new Date("October 2, 2014") },
{title: "A", number: 1, date: new Date("October 1, 2014") },
];
var ascData = [
{title: "A", number: 1, date: new Date("October 1, 2014") },
{title: "B", number: 2, date: new Date("October 2, 2014") },
];
@gerzhan
gerzhan / index.js
Last active December 29, 2015 07:19
Cordova or PhoneGap detect
document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1
@gerzhan
gerzhan / toCamelCase.js
Created December 27, 2015 12:18
To Camel Case build
function toCamelCase(str) {
return str.replace(/[_-][a-z]/ig, function (s) {
return s.substring(1).toUpperCase();
});
@gerzhan
gerzhan / app.js
Last active December 25, 2015 06:11
Audio fix for mobile quizegame for BWT
...
F7.onPageInit('question', function(page) {
if (page.context.audio) {
document.getElementById('main-audio').className = 'question-audio';
game.playSound(page.context.audio);
};
});
...
@gerzhan
gerzhan / detect-autoplay.js
Created December 23, 2015 10:47 — forked from mrcoles/detect-autoplay.js
A script to detect browser support for the autoplay attribute on the HTML5 Audio element.
// Detect autoplay
// ---------------
// This script detects whether the current browser supports the
// autoplay feature for HTML5 Audio elements, and it sets the
// `AUTOPLAY` variable accordingly.
// Used in the Meteor app [PicDinner](http://picdinner.com)
@gerzhan
gerzhan / build.js
Created December 4, 2015 09:40 — forked from dgg/build.js
automating-phonegap-builds-with-gulp
gulp.task('build', gulpsync.sync(['unlock', 'compress']), function () {
var endpoint = '/apps/' + config.phoneGap.appId;
var env = config.ensure.environment(argv.env, argv.debugmode);
pgBuild.auth({ token: config.phoneGap.authToken }, function (e, api) {
gulp.src('tmp/*.zip').pipe(tap(function (file, t) {
var options = {
form: {
data: {
myApp.directive("jplayer", ['$window', 'PlayerService', function ($window, PlayerService) {
return {
restrict: "E",
// Have our own scope - we only want to watch the service and not conflict with other scopes
scope: {},
// Serve up some html with our player
templateUrl: "/jplayer-template.html",
link: function (scope, element, attrs) {
// An element on the page to attach the jPlayer to. Could also use "element" from linkFN ^
var jPlayer = angular.element("#jquery_jplayer_1").jPlayer();