Skip to content

Instantly share code, notes, and snippets.

@veekas
veekas / slack-dark-theme-instructions.md
Last active March 21, 2019 15:49
Dark theme for Mac Slack App

Dark theme for Mac Slack App

These instructions are my personal implementation of the Slack Black Theme repo. In particular, it is an amalgamation of the css styles in this issue: https://github.com/widget-/slack-black-theme/issues/48

Open ssb-interop.js

Its location will be at /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js

Add the contents of slack-dark-theme.js

@zhenyanghua
zhenyanghua / Customer.js
Created October 4, 2016 19:04
Loopback query role by user Id
var _ = require('underscore');
module.exports = function(Customer) {
Customer.getRolesById = function (id, cb) {
Customer.getApp(function (err, app) {
if (err) throw err;
var RoleMapping = app.models.RoleMapping;
var Role = app.models.Role;
RoleMapping.find({ where : { principalId: id }}, function (err, roleMappings) {
var roleIds = _.uniq(roleMappings
@joseluisq
joseluisq / add_two_times.js
Last active April 16, 2024 07:06
Add two string time values (HH:mm:ss) with javascript
/**
* Add two string time values (HH:mm:ss) with javascript
*
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
* > addTimes('04:35:10', '21:35:10');
* > "26:10:20"
* > addTimes('30:59', '17:10');
* > "48:09:00"
@allupaku
allupaku / Order.js
Last active November 7, 2017 14:38
This is a modified version for createChangeStream - because the default implementation as of today is not supporting where filter. This is using the same approach from persisted model and using loopback-filters for parsing the data which is been passed in. This may not be a perfect solution but a good workaround till we get the filters in core c…
var applyFilter = require('loopback-filters');
var loopback = require('loopback');
var PassThrough = require('stream').PassThrough;
module.exports = function(Order) {
Order.createChangeStream = function(options,cb) {
/* Based on persisted-model#createChangeStream
@jwebcat
jwebcat / ngrok-installation.md
Created December 23, 2015 06:58 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

#Installing ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@leftclickben
leftclickben / admin-access.js
Last active July 4, 2018 00:58 — forked from spencermefford/0-model-override.js
An alternative to extending Loopback's built-in models: use a boot script to enhance the built-in model
(function () {
'use strict';
// Relevant resource: https://gist.github.com/spencermefford/bc73812f216e0e254ad1
module.exports = function (server, callback) {
var ACL = server.models.ACL,
User = server.models.User,
Role = server.models.Role,
RoleMapping = server.models.RoleMapping;
@njcaruso
njcaruso / controller.snippet.js
Last active October 27, 2021 04:17
Custom loopback change-stream to only show stream updates from the logged in user. The intent is to have a `Message` model that contains private messages for users. The current implementation of change-stream while it accepts an options.where clause, it does not use it. See https://github.com/strongloop/angular-live-set/issues/11.
var url = '/api/messages/stream-updates' +
'?access_token=' + LoopBackAuth.accessTokenId;
var src = new EventSource(url);
var changes = createChangeStream(src);
var set;
Message.find({
filter: {
where: {
@spencermefford
spencermefford / 0-model-override.js
Created July 28, 2015 02:51
An alternative to extending Loopback's built in models. In our application, we wanted to create a custom role called "ecm-administrator" that would have the ability to create and manage users.
module.exports = function (app) {
var _ = require('lodash');
var User = app.models.User;
var Role = app.models.Role;
var RoleMapping = app.models.RoleMapping;
var ACL = app.models.ACL;
/*
* Configure ACL's
*/
/* This variable is for demonstration only, but the naming convention is a shorthand for:
** $globalVar-spacingVar-baseline
*/
$g-s-baseline: 23px;
/* You could imagine different variables following the same pattern, for example:
** $g-c-blue (global, color, blue)
** $l-f-sans (local/themed, font, sans-serif)
*/
@tommymarshall
tommymarshall / custom_user_bindings.sublime-keymap
Last active April 26, 2020 01:04
Custom User Bindings for using AlignTab with ='s, =>'s, and :'s in Sublime Text
[
{
"keys": ["control+alt+;"], "command": "align_tab",
"args" : {
"user_input" : ":/f"
}
},
{
"keys": ["control+alt+="], "command": "align_tab",
"args" : {