Skip to content

Instantly share code, notes, and snippets.

View munkhorgil's full-sized avatar
🎯
Focusing

Orgil munkhorgil

🎯
Focusing
View GitHub Profile
@iPublicis
iPublicis / myapp-node-watcher.path
Last active March 26, 2024 21:06
NODE.JS app as a systemd service with CI controller
#########
# File: myapp-node-watcher.path
#
# Save this to /etc/systemd/system/
# Run systemctl enable myapp-node-watcher.path && systemctl daemon-reload && systemctl start myapp-node-watcher.path
#
[Path]
PathModified=/home/myuser/myappdir/public_html
[Install]
@devarajchidambaram
devarajchidambaram / stubfs.js
Created September 7, 2018 07:28
How to stub fs.readFile functions
const fs = require('fs')
function readFile (filename) {
if (fs.existsSync(filename)) {
return fs.readFileSync(filename, 'utf8')
}
throw new Error('Cannot find file ' + filename)
}
describe('mocking individual fs sync methods', () => {
@siwalikm
siwalikm / JSmemory.md
Last active June 24, 2023 05:54
JS reference and scope
var foo = {'bar': 1};

function overwriteFoo(obj) {
   obj = {'bar': 2};
}

function overwriteFooBar(obj) {
   obj.bar = 2;
}

overwriteFoo(foo)

Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!
@DimitryDushkin
DimitryDushkin / react-router-queyry-utils.js
Last active March 5, 2021 13:38
React router utility functions to add and remove queries
import { browserHistory } from 'react-router';
/**
* @param {Object} query
*/
export const addQuery = (query) => {
const location = Object.assign({}, browserHistory.getCurrentLocation());
Object.assign(location.query, query);
browserHistory.push(location);
};
@jonathansick
jonathansick / query.graphql
Last active January 20, 2024 07:58
GitHub GraphQL repo commit history query
{
repository(name: "sickvim", owner: "jonathansick") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
@maciekish
maciekish / resetXcode.sh
Created August 10, 2016 10:13
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
@styopdev
styopdev / loading.js
Created July 8, 2016 13:20
Node,js console loading
var startLoader = function () {
(function() {
process.stdout.write('Some text here...' + "\n");
var P = ["\\", "|", "/", "-"];
var x = 0;
return setInterval(function() {
process.stdout.write("\r" + P[x++]);
x &= 3;
}, 250).unref();
})();
@jarretmoses
jarretmoses / React Native Clear Cache
Last active July 17, 2024 15:14
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@antoineMoPa
antoineMoPa / crawl.sh
Last active December 20, 2023 16:55
Bash Web Crawler
# bash web crawler
# $ bash crawl.sh http://example.com
rm urls.txt
rm sub-urls.txt
rm sub-2-urls.txt
site=$1
function visit(){