Skip to content

Instantly share code, notes, and snippets.

View dimorphic's full-sized avatar
🤖
*void 0*

Sabin Tudor dimorphic

🤖
*void 0*
View GitHub Profile
@dimorphic
dimorphic / angular-debug-directive.js
Created October 6, 2015 20:56
Angular custom debug directive (for directives?)
app.directive('customDebug', function($compile) {
return {
terminal: true,
link: function(scope, element) {
var currentElement = element.clone();
currentElement.removeAttr("custom-debug");
var newElement = $compile(currentElement)(scope);
element.attr("style", "border: 1px solid red");
element.after(newElement);
}
@dimorphic
dimorphic / requirejs-env-switch.js
Created November 16, 2015 22:51
RequireJS environment switch?
require.config({
paths: {
'jquery' : (function(){
if( MODE == 'DEV' ){
return 'jquery';
}else{
return 'jquery.min'
}
})()
}

Install needed node packages:

npm install -g cylon-ble
npm install cylon cylon-ollie

First scan for your BB8 (the device name should contain BB in it):

> sudo cylon-ble-scan
[...]
@dimorphic
dimorphic / doc-ready.md
Created February 16, 2016 10:05
js pure document ready

layout: post

title: Detect document ready in pure JS tip-number: 46 tip-username: loverajoel tip-username-profile: https://www.twitter.com/loverajoel tip-tldr: The cross-browser way to check if the document has loaded in pure JavaScript

categories:

@dimorphic
dimorphic / Readme.md
Last active May 18, 2016 09:08 — forked from timoxley/Readme.md
JS Pop Quiz: How well do you know your functions?

JS Pop Quiz: How well do you know your functions?

Given an Array of Functions fns, what argument(s) can you pass to fns.forEach such that each function in fns will execute, in order, without creating any anonymous (or named) functions or invoking the Function constructor?

Conditions

  • Do not use the function keyword, or arrow functions () => .
  • Do not invoke the Function constructor.
  • Function#bind & friends on the Function.prototype are ok.
  • Answer should be a single line.
@dimorphic
dimorphic / ngrxintro.md
Created July 25, 2016 08:00 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

#Comprehensive Introduction to @ngrx/store By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@dimorphic
dimorphic / react-gmaps-loader.jsx
Created July 27, 2016 08:43
react google maps script loader example
import {
ReactScriptLoader,
ReactScriptLoaderMixin,
} from 'react-script-loader';
export default class UiMap extends React.Component {
constructor(props) {
super(props);
this.state = {
scriptLoading: true,
@dimorphic
dimorphic / better-nodejs-require-paths.md
Created September 3, 2016 17:03 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@dimorphic
dimorphic / core.js
Created September 19, 2016 10:03 — forked from RobK/core.js
Generating AWS HMAC in Nodejs (RFC 2104 compliant HMAC)
var crypto = require("crypto");
/**
* Get the signature/digest of a supplied input string
* @param data [Required] The String to encode
* @param awsSecretKey [Required] Secret key shared with Amazon
* @param algorithm [Optional] Encryption algorithm, defaults to sha256
* @param encoding [Optional] The output encoding. Default to base64
* @returns Str with encoded digest of the input string
*/
function generateHmac (data, awsSecretKey, algorithm, encoding) {
@dimorphic
dimorphic / asus-sabertooth-z170-mark1-4.5ghz.txt
Created December 3, 2016 21:44
ASUS SABERTOOTH Z170 MARK 1 - 4.5Ghz OC cpu / ram ?
Am revenit cu setarile din bios pentru i7-6700k la 4,5 ghz si ram Corsair DDR4 la 3200 Mhz;
Inainte totusi un mic disclaimer: aceste setari de mai jos merg la mine, nu inseamna neaparat ca vor merge pe toate sistemele cu i7 6700k; depinde din ce lot de fabricatie ati nimerit procesorul, de tipul de ram si bineinteles de versiunea de bios;
Iata setarile pentru bios versiunea 1801 pe aceasta placa de baza asa cum le-am gasit eu stabile dupa 5-6 saptamani de testari:
AI OVERCLOCK TUNER - Manual
BCLK Frequency - 100.00
ASUS MULTICORE ENHANCEMENT - Disabled
CPU CORE RATIO - SYNC ALL Cores
1-Core Ratio Limit - 45 (adica frecventa 4,5 ghz)