Skip to content

Instantly share code, notes, and snippets.

View leeroybrun's full-sized avatar

Leeroy Brun leeroybrun

View GitHub Profile
@leeroybrun
leeroybrun / deploy-pm2.md
Last active November 18, 2021 14:20 — forked from hoangmirs/deploy-pm2.md
Deploy pm2 guide
@leeroybrun
leeroybrun / pixelpeeper.userscript.js
Last active May 6, 2023 02:15
Tampermonkey / Greasemonkey script to check images of webpage with Pixelpeeper
// ==UserScript==
// @name Pixelpeeper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant GM_xmlhttpRequest
// @grant GM_openInTab
// ==/UserScript==
@leeroybrun
leeroybrun / TorrentLeech-notify.user.js
Created July 6, 2017 07:52
Notify when new torrents appears on TorrentLeech. Check every 30s.
// ==UserScript==
// @name TorrentLeech-notify
// @namespace https://www.torrentleech.org/
// @version 0.1
// @description Notify when new torrents appears on TorrentLeech. Check every 30s.
// @author Leeroy Brun
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @match https://www.torrentleech.org/torrents/browse*
// @grant GM_getValue
// @grant GM_setValue
@leeroybrun
leeroybrun / Delete commit
Last active August 29, 2015 14:01
Git tips
http://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git
Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command.
git reset --hard HEAD~1
or
git reset --hard <sha1-commit-id>
@leeroybrun
leeroybrun / turn_all_off.lua
Last active March 1, 2021 05:59
Fibaro LUA scenes
--[[
%% autostart
%% properties
%% globals
--]]
NB_DEVICES = 300
function turnAllOff()
fibaro:debug('Turn all devices off.')
@leeroybrun
leeroybrun / gist:8685383
Created January 29, 2014 10:34
Object-Oriented Javascript - Class - Methods - Static - Private - Public
// From : http://stackoverflow.com/a/1635143/1160800
// constructor function
function MyClass () {
var privateVariable; // private member only available within the constructor fn
this.privilegedMethod = function () { // it can access private members
//..
};
}
@leeroybrun
leeroybrun / gist:8597615
Created January 24, 2014 13:51
AngularJS tips & tricks
// ------------------------------------------------------
// Set focus on an element
// Source : http://stackoverflow.com/a/14837021/1160800
// ------------------------------------------------------
app.directive('focusMe', function($timeout, $parse) {
return {
//scope: true, // optionally create a child scope
link: function(scope, element, attrs) {
var model = $parse(attrs.focusMe);
scope.$watch(model, function(value) {
@leeroybrun
leeroybrun / gist:8596604
Created January 24, 2014 12:48
iOS tips and tricks
// Disable HTTPS warnings/errors
@implementation NSURLRequest(NSURLRequestWithIgnoredSSL)
+(BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
return YES;
}
@end
@leeroybrun
leeroybrun / gist:8596535
Created January 24, 2014 12:43
CSS tricks for iOS web apps
/* Disable selection on iOS devices */
* {
-webkit-touch-callout: none;
-webkit-user-select: none; /* Disable selection/copy in UIWebView */
}
/* Smooth scrolling */
.container {
overflow: scroll;
-webkit-overflow-scrolling: touch;
@leeroybrun
leeroybrun / gist:8021774
Created December 18, 2013 12:49
ReplaceAll Javascript function. You can pass a simple string or an array of string to replace. They will be replaced with a single string. (replacement of multiple to multiple not supported)
function replaceAll(string, search, replace) {
if(Array.isArray(search) === false) {
search = [search];
}
search.forEach(function(txt) {
string = string.split(txt).join(replace);
});
return string;