Skip to content

Instantly share code, notes, and snippets.

View arvinsingla's full-sized avatar
🍕

Arvin Singla arvinsingla

🍕
View GitHub Profile
@nblumoe
nblumoe / angularjs_resource_tokenhandler.js
Created July 5, 2012 07:34
AngularJS service to send auth token with $resource requests
.factory('TokenHandler', function() {
var tokenHandler = {};
var token = "none";
tokenHandler.set = function( newToken ) {
token = newToken;
};
tokenHandler.get = function() {
return token;
@jhedstrom
jhedstrom / FeatureContext.php
Last active April 5, 2019 10:25
Step-definition for complex node structure (field collection + entity reference).
<?php
/**
* @Given /^I am viewing a product with the following related products:$/
*/
public function assertRelatedProducts(TableNode $relatedProducts) {
// First, create a product.
$product = (object) array(
'title' => 'Parent Product',
'type' => 'product',
'uid' => 1,
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
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>
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@paulirish
paulirish / what-forces-layout.md
Last active April 19, 2024 06:03
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Arjeno
Arjeno / circle.yml
Created August 17, 2016 13:57
Always use the latest version of Chrome on CircleCI
# This makes sure Chrome is always up to date in your test suite
# On average this adds about 10 seconds to your build suite
# Be sure to use Ubuntu 14.04 (Trusty) in the CircleCI's OS setting (Settings > Build Environment)
dependencies:
pre:
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome.deb
- sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
- rm google-chrome.deb
@codediodeio
codediodeio / database.rules.json
Last active January 28, 2024 19:07
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@gspivey
gspivey / Fling_ISO_Creation.md
Created December 3, 2021 07:21
Parameterized steps for creating a fling ISO for ESXi

Parameterized steps for creating a fling ISO for ESXi

Powershell Permissions

List Execution Policies Get-ExecutionPolicy -List Set Excecution Policy (Requires Running terminal as Admministrator) Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope LocalMachine Return Excecution Policy (Requires Running terminal as Admministrator) Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope LocalMachine