Skip to content

Instantly share code, notes, and snippets.

View theMikeD's full-sized avatar

theMikeD theMikeD

View GitHub Profile
@bgrins
bgrins / Log-.md
Last active August 1, 2023 16:32
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@demoive
demoive / vendorify.less
Last active December 17, 2015 16:49
A LESS mixin to generate vendor-specific (browser-specific/experimental) CSS properties.
.vendorify(@prop, @vals...) {
@property: e('@{prop}');
@values: `'@{arguments}'.replace(/^\[|\]$/g, '').split(', ').splice(1)`;
// v1.6.0 added interpolation allowing us to do this:
-o-@{property}: @values;
-ms-@{property}: @values;
-moz-@{property}: @values;
-webkit-@{property}: @values;
@{property}: @values;
@Mte90
Mte90 / Customfile
Last active December 10, 2021 14:55
2 new commands for VVV
class VVVScripts < Vagrant.plugin(2, :command)
def self.synopsis
"Execute script from /config/homebin/"
end
def execute
with_target_vms(nil, single_target: true) do |vm|
@env.ui.output "#{$yellow}Executing #{$red}#{ARGV[1]}#{$creset}\n"
vm.action(:ssh_run, ssh_run_command: "/srv/config/homebin/#{ARGV[1]}" )
end