Skip to content

Instantly share code, notes, and snippets.

@bmkmanoj
bmkmanoj / bookmarklet.js
Created May 19, 2020 — forked from lpsBetty/bookmarklet.js
howto make an angular app with a JS bookmarklet
View bookmarklet.js
/**
* 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 — 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.
View node-and-npm-in-30-seconds.sh
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 Apr 23, 2020 — forked from jed/LICENSE.txt
generate random UUIDs
View LICENSE.txt
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 Apr 17, 2020 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
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 Apr 17, 2020 — forked from gaearon/connect.js
connect.js explained
View connect.js
// 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 (
View mark-and-sweep-gc.js
/**
* 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 Mar 11, 2020 — 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.
View gist:5b24ff3098b53d07d7229361284671b8
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:
View 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
View cheatsheet.md

ServiceNow UI Developer cheat sheet


Utility URLs

URL Purpose
/stats.do Quick stats
/cache.do Clear your instance cache
@bmkmanoj
bmkmanoj / iphonsimulatorDefaults.sh
Created Nov 20, 2019 — forked from hisaos/iphonsimulatorDefaults.sh
defaults and com.apple.iphonesimulator
View iphonsimulatorDefaults.sh
# 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}"
You can’t perform that action at this time.