Skip to content

Instantly share code, notes, and snippets.

View auxcoder's full-sized avatar
🗼
Working from home

AuxCoder auxcoder

🗼
Working from home
View GitHub Profile
@auxcoder
auxcoder / reload.js
Created January 18, 2018 14:39
Reload current State one time (angular, ui-router)
$ctrl.reload = function() {
return $state.transitionTo($state.current, $stateParams, {
reload: true
}).then(function() {
$ctrl.hideContent = true;
return $timeout(function() {
return $ctrl.hideContent = false;
}, 1);
});
};
@auxcoder
auxcoder / print.css
Created November 4, 2017 16:37
Set of print styles
/* Print styles */
body {
width:100% !important;
margin:0 !important;
padding:0 !important;
line-height: 1.45;
font-family: Garamond,"Times New Roman", serif;
color: #000;
background: none;
@auxcoder
auxcoder / typescript_angular.adoc
Created August 10, 2017 03:59 — forked from esfand/typescript_angular.adoc
AngularJS with TypeScript
@auxcoder
auxcoder / build-hash.md
Created August 7, 2017 13:14
Generate hash from string, Javascript
function _buildHash(value) {
  var hash = 0, i, currChr;
  if (value.length === 0) { return hash; }
  for (i = 0; i < value.length; i++) {
    currChr = value.charCodeAt(i);
    hash = ((hash << 5) - hash) + currChr; // jshint ignore:line
    hash |= 0; // jshint ignore:line
  }
 return hash.toString(2);
@auxcoder
auxcoder / convert-img-to-base64.js
Created August 2, 2017 15:18
Converting an image to base64 encode from its url
// from a component controller
toDataURL(
image_url
).then(
function onsuccess(response) {
ctrl.ngModel.$setViewValue(ctrl.previousImage);
},
function onError(response) {
$log.error(response);
}
@auxcoder
auxcoder / version-modifiers.md
Created July 31, 2017 20:03
Versions && prefixies meaning

When defining dependencies some prefixes are used.

"dependencies": {
  "a": "~1.0.6",
  "b": "^1.0.6",
  "b": "*"
}
@auxcoder
auxcoder / upgrade-guide.md
Last active July 20, 2017 13:30 — forked from joho/gist:3735740
PostgreSQL upgrade steps and common commands

Steps to install and run PostgreSQL using Homebrew (Mac OS X)

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Rename the old version and update PostgreSQL

mv /usr/local/var/postgres /usr/local/var/postgres91
brew update
@auxcoder
auxcoder / dev-tools-tips.md
Last active March 9, 2017 21:56
Chrome Dev Tools Tips

Chrome Dev Tools tips

Interpolation

Insert data into message.

var myVar = 123;
console.log('Var value is %s', myVar);
console.log(`Var value is ${myVar}`);
@auxcoder
auxcoder / sass-lists-loops-control.md
Last active February 28, 2017 14:51
Examples of control flow and loop iteration in SASS

Sass control flow and loop iterations

@if @else

The @if control directive takes an expression and processes its block of styles if the expression is true. This example let us define styles base in the devise orientation.

@mixin iPad($orientation: null){
	@media only screen
@auxcoder
auxcoder / angularjs_directive_attribute_explanation.md
Created February 23, 2017 18:09 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>