Skip to content

Instantly share code, notes, and snippets.

View Leftyx's full-sized avatar
🎯
Focusing

Leftyx Leftyx

🎯
Focusing
View GitHub Profile
@Leftyx
Leftyx / connection_pools.sql
Created December 6, 2018 10:36
Sql Server: Monitor connection pools
select
sess.login_name as [Login Name],
sess.host_name as [Client Machine],
db.name as [Database],
sess.program_name as [Client Program],
COUNT(*) as [Open Connections],
AVG(DATEDIFF(MILLISECOND, conn.connect_time, sssn.login_time)) AS [MillisecondsBetweenConnectionAndSessionStart]
from sys.dm_exec_sessions sess (nolock)
left join sys.dm_exec_requests r (nolock)
on r.session_id = sess.session_id
@Leftyx
Leftyx / before_prepare\02_jshint.js
Created September 17, 2015 14:37
Ionic hooks: detect errors and potential problems in your JavaScript code
#!/usr/bin/env node
// detect errors and potential problems in your JavaScript code.
// v1.0
// foldersToProcess = array of folders with the js files to js-lint.
var fs = require('fs');
var path = require('path');
var jshint = require('jshint').JSHINT;
var async = require('async');
@Leftyx
Leftyx / after_prepare\015_prepare_index_html.js
Created September 17, 2015 14:37
Ionic hooks: useref index.html file.
#!/usr/bin/env node
// useref index.html
// v1.0
// searches the node-useref tags in your index.html to replace it width
// the bundle.
// https://www.npmjs.com/package/node-useref
var fs = require('fs');
var path = require('path');
@Leftyx
Leftyx / after_prepare\014_uglify.js
Created September 17, 2015 14:36
Ionic hooks: uglify and minify js and css files.
#!/usr/bin/env node
// uglify the js and css file.
// v1.0
// foldersToProcess: array of folders where the js and css file are.
var fs = require('fs');
var path = require('path');
var UglifyJS = require('uglify-js');
var CleanCSS = require('clean-css');
@Leftyx
Leftyx / after_prepare\013_unused_folders_delete.js
Created September 17, 2015 14:35
Ionic hooks: delete all unused folders.
#!/usr/bin/env node
// Remove unused folder which are not needed by our app.
// v1.0
// Since the lib folder will be deleted we need to move the fonts
// referenced in the css to the root.
// foldersToRemove = array of folders to remove.
var fs = require('fs');
var path = require('path');
@Leftyx
Leftyx / after_prepare\012_concat_files_in_index.js
Created September 17, 2015 14:34
Ionic hooks: concat all js and css files in index.html
#!/usr/bin/env node
// Parses the index.html file search for js and css files.
// v1.0
// all the files will be concatenated in 2 files.
// Note: It does not touch cordova.js.
// appConcatFolder: folder for the js bundle.
// appConcatFile: name of the js file bundle.
// cssConcatFolder = folder of the css bundle;
// cssConcatFile = name of the css file bundle;
@Leftyx
Leftyx / after_prepare\011_move_fonts_to_root.js
Created September 17, 2015 14:32
Ionic hooks: move fonts in the root\fonts
#!/usr/bin/env node
// Move fonts in lib/ionic/fonts to the root in fonts folder
// v1.0
// Since the lib folder will be deleted we need to move the fonts
// referenced in the css to the root.
// foldersWithFontsToMove = array of folders containing fonts files you want to move in the root.
var fs = require('fs');
var path = require('path');
(function() {
'use strict';
angular
.module('starter')
.controller('home', homeController);
homeController.$inject = ['$scope', '$q', '$http', '$filter'];
/* @ngInject */
@Leftyx
Leftyx / 0_reuse_code.js
Created March 21, 2014 09:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console