Skip to content

Instantly share code, notes, and snippets.

View shawnrice's full-sized avatar

Shawn Patrick Rice shawnrice

  • Cobbler
  • Greater New York City
View GitHub Profile
@pulkitsinghal
pulkitsinghal / 01-override-User-model.js
Created December 2, 2014 03:27
Strongloop/Loopback - Override User model via boot script
module.exports = function(app) {
var User = app.models.User;
// TODO: (1) find an example of how to add new "properties" to the built-in User mode via boot script
// (2) This is how you can add a "relationship" to the built-in User model via boot script
var SomeOtherModel = app.models.SomeOtherModel;
User.hasMany(SomeOtherModel, {as: 'someOtherModels', foreignKey: 'someOtherModelId'});
// (3) This is how you can add "remote methods" to the built-in User model via boot script
@codler
codler / flex.less
Last active October 7, 2023 07:01
Prefix flex for IE10 and Safari / iOS in LESS
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {
@lavoiesl
lavoiesl / sysbench.sh
Last active October 21, 2017 00:15
Sysbench wrapper for several tests of sysbench
#!/usr/bin/env bash
# Sysbench wrapper for several tests of sysbench
# Scales with number of processors, works on mac and linux
#
# @link https://gist.github.com/lavoiesl/7536567
#
# wget https://gist.github.com/lavoiesl/7536567/raw/sysbench.sh -O - 2>/dev/null | bash
#
# Requires http://sysbench.sourceforge.net/
@lavoiesl
lavoiesl / service.sh
Last active May 3, 2023 11:52
Mac OS launchctl utility with support for partial match
#!/bin/bash
# Mac OS launchctl utility
# Support partial match
# Will exit on error if no of more than one service is found.
#
# @link http://blog.lavoie.sl/2013/08/service-management-utility-for-mac-osx.html
# @link https://gist.github.com/lavoiesl/6160897
#
# Usage:
# service selfupdate
@docwhat
docwhat / traceback_example.bash
Last active April 6, 2022 02:52
A template showing how to do bash tracebacks. This makes using `set -eu` much more comfortable.
#!/bin/bash
#
# Tracebacks in bash
# https://docwhat.org/tracebacks-in-bash/
#
# Just take the code between the "cut here" lines
# and put it in your own program.
#
# Written by Christian Höltje
# Donated to the public domain in 2013
@lavoiesl
lavoiesl / time-spender-logger.php
Last active December 11, 2015 23:59
On each PHP request (cli, cgi or apache module), this script will detect to which project the file belongs and log it.
<?php
/**
* On each PHP request (cli, cgi or apache module),
* this script will detect to which project the file belongs and log it.
* It also features a threshold so a couple consecutive minutes without a request
* doesn't stop your timer, see below.
*
* To install, configure the roots (see below) add this line to your php.ini:
* auto_prepend_file=/path/to/file/time-spender-logger.php
*
@wolever
wolever / MIT-LICENSE.txt
Last active June 1, 2022 05:42 — forked from niw/MIT-LICENSE.txt
Put a mac's AirPort in HostAP mode. Updated to work with OS X 10.8.
Copyright (C) 2012 Yoshimasa Niwa
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@lavoiesl
lavoiesl / gitconfig
Created October 10, 2012 11:02
gitconfig
# http://blog.lavoie.sl/2012/10/git-tutorial-and-global-configs.html
[user]
name = Sébastien Lavoie
email = github@lavoie.sl
[color]
diff = auto
status = auto
branch = auto
<?php
// file: ./Shape/Circle.php
namespace Shape;
class Circle extends Shape implements ShapeInterface {
public function __construct() {
var_dump($this);
}
@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat