Skip to content

Instantly share code, notes, and snippets.

View legomushroom's full-sized avatar
🇺🇦
stop russizm

Oleg Solomko legomushroom

🇺🇦
stop russizm
View GitHub Profile
@amoilanen
amoilanen / promisify_require.js
Last active April 1, 2021 13:54
Enhances 'require' from RequireJS with Promises API while preserving its original semantics. Now 'require' calls can be chained.
/*
* Enhances 'require' from RequireJS with Promises API while preserving its original semantics.
*/
(function() {
if (!Promise || !require) {
return;
}
@jonathantneal
jonathantneal / Demo
Created April 18, 2012 17:13
addEventListener for IE8
http://jsfiddle.net/GuQaV/show/
@rlopc
rlopc / costLogisticRegressionRegularized.matlab
Created December 31, 2013 10:52
Compute cost and gradient for logistic regression with regularization
function [J, grad] = costFunctionReg(theta, X, y, lambda)
%COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
% J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
% theta as the parameter for regularized logistic regression and the
% gradient of the cost w.r.t. to the parameters.
% Initialize some useful values
m = length(y); % number of training examples
% You need to return the following variables correctly
@revolunet
revolunet / angularjs.md
Last active October 22, 2021 00:36
BeerJS + AngularJS Paris le 25/2

AngularJS best ressources

Following the AngularJS PARIS meetup (25/2 à 19h à Paris with @sampaccoud @dzen @_kemar @tchack13 @vinz et @revolunet)

Here's our best AngularJS ressources : twitter, github, articles & blogs. Please comment and add your good stuff !

@adamcbrewer
adamcbrewer / clickEventType.js
Last active October 22, 2021 20:29
JS: Detect for supported 'touchstart' events.
/**
* Using default click events in touch-supported devices
* incurs a delay (in order to determine if the user is performing a gesture).
*
* Detecting for touchstart events using the foloowing, we can replace the default 'clicks'
* for touch events, making a snappier experience for mobile/touch devices.
* Use wisely as this could prevent some gestures from happening. If there are scrolling
* issues try swap out 'touchstart' for 'touchend'
*
*/
@lukeed
lukeed / OSX-Dock-Spacers.md
Last active November 12, 2021 20:51
OSX Dock Spacers

Huh?

Some MacOS users have very cluttered Docks & wish they could organize them without removing any App icons from the mix.

This snippet will add an empty "spacer" that you can drag around and use to separate icons into groups! See example.

Command

Paste this into your Terminal. Run the command for additional placeholders!

@mattstauffer
mattstauffer / blog.md
Last active November 13, 2021 10:46
Introducing Gistlog landing pages

It's great that Gistlog makes it easy to write Gist-powered, Markdown-formatted, blog posts. But what if you want to use it as your entire blogging platform? We're working on it, and here's a first step: user landing pages.

Any Github user that has any public gists that contain a file named gistlog.yml now have a landing page on Gistlog at http://gistlog.co/your-user-name. So, since I have (more than) one, you can view my landing page at gistlog.co/mattstauffer. It's very simple right now, but we have a ton of ideas to improve it over time. So go check it out.

How do you get your own Gistlog landing page?

  1. Create a new Gistlog Gist (or edit an old one)
  2. Create two files: one for the markdown (I recommend blog.md for the name) and one for the Gistlog settings (which must be named gistlog.yml)
  3. Write your blog post in blog.md
  4. Since there are no actual settings being parsed from gistlog.yml yet, just create it with the fol
@cprovatas
cprovatas / gist:6acef442fc43123bcd5d5e937dc7951a
Created January 6, 2018 21:57
Monitor Mouse Event for any arbitrary application on macOS in Swift
let callback: CGEventTapCallBack = { (tapProxy, eventType, event, refcon) -> Unmanaged<CGEvent>? in
debugPrint("we are monitoring the mouse event here")
return nil
}
let eventMask = (1 << CGEventType.leftMouseDown.rawValue) | (1 << CGEventType.leftMouseUp.rawValue)
let machPort = CGEvent.tapCreateForPid(pid: 40529, place: .tailAppendEventTap, options: .defaultTap, eventsOfInterest: CGEventMask(eventMask), callback: callback, userInfo: nil)!
let runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, machPort, 0)
@archerslaw
archerslaw / solve the "no network with matching name 'default'" problem.
Last active March 7, 2023 06:01
solve the "no network with matching name 'default'" problem.
# virsh create rhel7.xml
error: Failed to create domain from rhel7.xml
error: Network not found: no network with matching name 'default'
# virsh net-list --all
Name State Autostart Persistent
----------------------------------------------------------
default active no yes
# virsh net-define /dev/stdin <<EOF