Skip to content

Instantly share code, notes, and snippets.

View nire0510's full-sized avatar

Nir Elbaz nire0510

  • Holisto
View GitHub Profile
@nire0510
nire0510 / jscs-settings-extraction.md
Last active August 29, 2015 14:23
Extracts all jscs settings to your clipboard
  1. Open JSCS - Rules page
  2. Open your browser's console and run the following script:
var objSettings = {};

[].forEach.call(document.querySelectorAll('.rule-list__item a'), function (element) {
  objSettings[element.text] = true;
});
@nire0510
nire0510 / .jscsrc
Last active January 20, 2016 11:02
JSCS configuration file
// http://jscs.info/rules.html
{
"verbose": true,
"excludeFiles": ["node_modules/**", "bower_components/**", ".tmp/**"],
"maxErrors": 20,
"disallowAnonymousFunctions": true,
//"disallowCapitalizedComments": true,
//"disallowCommaBeforeLineBreak": true,
"disallowCurlyBraces": null,
@nire0510
nire0510 / history.sql
Last active September 19, 2017 15:22
[MS SQL History] Search query in MSSQL queries history #database
SELECT t.[text]
FROM sys.dm_exec_cached_plans AS p
CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t
WHERE t.[text] LIKE N'%PART_OF_YOUR_QUERY%';
@nire0510
nire0510 / file.html
Created October 16, 2015 09:50
AngularJS - 2 modules, One page
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AngularJS - 2 modules, One page</title>
<meta name="feditor:preset" content="default"/>
</head>
<body>
<div id="first" data-ng-app="SampleApp1">
@nire0510
nire0510 / es6class.js
Created October 27, 2015 21:35
ES6/2015 class
'use strict';
class Person {
constructor (strName) {
this._name = strName;
console.log('My name is', this._name);
}
eat () {
console.log(this._name, 'is eating!');
}
@nire0510
nire0510 / file.css
Last active November 16, 2015 19:49
Angular Services
html, body {
height: 100%;
width: 100%;
margin: 0;
}
body {
background-color: #ededed;
}
@nire0510
nire0510 / google-webfont-loader.js
Created November 26, 2015 11:02
Dynamically download and serve web-fonts from Google's repo for better performance
(function (window) {
'use strict';
// Global configuration for web-font:
window.WebFontConfig = {
google: {
families: [ 'Oxygen:700,400:latin' ]
},
timeout: 2000
};
@nire0510
nire0510 / fallback.js
Created February 29, 2016 11:17
Ember helper: display fallback value if original is missing
import Ember from 'ember';
export function fallback(params/*, hash*/) {
return params[0] || params[1];
}
export default Ember.Helper.helper(fallback);
@nire0510
nire0510 / bind-html.js
Created February 29, 2016 11:18
Ember helper: bind html content value
import Ember from 'ember';
export function bindHtml(params/*, hash*/) {
return Ember.String.htmlSafe(params[0]);
}
export default Ember.Helper.helper(bindHtml);
@nire0510
nire0510 / eqw.js
Created February 29, 2016 11:19
Ember helper: performs weak equality (type agnostic)
import Ember from 'ember';
/**
* Performs weak equality comparison between two objects
* @param params
* @returns {boolean}
*/
export function eqw(params/*, hash*/) {
/*jslint eqeq: true*/
return params[0] == params[1];