Skip to content

Instantly share code, notes, and snippets.

@bmkmanoj
bmkmanoj / bookmarklet.js
Created May 19, 2020 05:53 — forked from bettysteger/bookmarklet.js
howto make an angular app with a JS bookmarklet
/**
* redirect javascript bookmarklet
*/
// javascript:location.href='http://example.com/?uri='+encodeURIComponent(location.href)
/**
* bookmarklet loaded on site
*/
(function(){
@bmkmanoj
bmkmanoj / node-and-npm-in-30-seconds.sh
Created May 13, 2020 04:56 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@bmkmanoj
bmkmanoj / LICENSE.txt
Created April 23, 2020 05:04 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bmkmanoj
bmkmanoj / slim-redux.js
Created April 17, 2020 14:36 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@bmkmanoj
bmkmanoj / connect.js
Created April 17, 2020 14:36 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
/**
* Mark and Sweep Garbage Collection technique.
* MIT Style License
* by Dmitry Soshnikov
*/
// This diff describes the simplest version of mark and sweep
// GC in order to understand the basic idea. In real practice the
// implementation can be much tricker and optimized.
@bmkmanoj
bmkmanoj / gist:5b24ff3098b53d07d7229361284671b8
Created March 11, 2020 10:39 — forked from subfuzion/gist:1128192
Git Tips: Reset, Clean - Remove untracked files and directories from the working tree when switching branches or checking out different commits.
git reset --hard
git clean -f -d
Description:
============
Git Tips: Remove untracked files and directories from the working
tree when switching branches or checking out different commits.
Explanation:
@bmkmanoj
bmkmanoj / jquery.js
Last active March 1, 2020 07:35 — forked from rwaldron/jquery.js
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license

ServiceNow UI Developer cheat sheet


Utility URLs

URL Purpose
/stats.do Quick stats
/cache.do Clear your instance cache
@bmkmanoj
bmkmanoj / iphonsimulatorDefaults.sh
Created November 20, 2019 09:42 — forked from hisaos/iphonsimulatorDefaults.sh
defaults and com.apple.iphonesimulator
# defaults commands with com.apple.iphonesimulator
# usage in detail will show with `defaults` without any arguments
# this sets default simulator device to iPhone
defaults write com.apple.iphonesimulator SimulateDevice -string "iPhone"
defaults write com.apple.iphonesimulator SimulateSDKRoot -string "${SDKROOT_iphonesimulator}"
# this sets default simulator device to iPad
defaults write com.apple.iphonesimulator SimulateDevice -string "iPad"
defaults write com.apple.iphonesimulator SimulateSDKRoot -string "${SDKROOT_iphonesimulator_ipad}"