Skip to content

Instantly share code, notes, and snippets.

@jpitchardu
jpitchardu / optional.js
Last active June 5, 2020 02:31
Optional API javascript
function optionalAccess(obj, path, def) {
const propNames = path.replace(/\]|\)/, "").split(/\.|\[|\(/);
return propNames.reduce((acc, prop) => acc[prop] || def, obj);
}
function proxyOptional(obj, evalFunc, def) {
const handler = {
get: function(target, prop, receiver) {
const res = Reflect.get(...arguments);
@arya-oss
arya-oss / INSTALL.md
Last active November 18, 2023 13:58
Ubuntu 16.04 Developer Tools installation

Ubuntu 16.04 Developer Tools Installation

First things first !

sudo apt update
sudo apt upgrade

Standard Developer Tools

sudo apt-get install build-essential git
@freakboy3742
freakboy3742 / rapid-mobile-development.rst
Last active December 8, 2022 11:22
Rapid Mobile Application Development with Python

Rapid mobile application development with Python

While there are examples of Python-based apps in mobile App stores, the knowledge of how to actually create a mobile app in Python hasn't been well documented, or simplified for mass use - until now.

In this talk, Dr Russell Keith-Magee will demonstrate a collection of tools from the BeeWare Project that enable you to build a cross-platform mobile app using Python in a matter of minutes.

Audience

@iann0036
iann0036 / auto.py
Last active February 2, 2024 04:06
Python Input Record and Play
import pyautogui, time, sys, os, win32api, win32gui, win32con, datetime, pyHook, pythoncom
from optparse import OptionParser
'''
Python Automated Actions Script by Ian Mckay
Version 0.1 - 20151217
'''
pyautogui.PAUSE = 0
pyautogui.FAILSAFE = True
@ovrmrw
ovrmrw / app+.js
Last active March 9, 2016 20:29
sample: ArangoDB's Foxx controller with using any library you want
(function() {
"use strict";
var Foxx = require("org/arangodb/foxx"),
controller = new Foxx.Controller(applicationContext),
_ = require("underscore"), // loading underscore.js in C:\Program Files\ArangoDB 2.2.4\share\arangodb\js\node\node_modules
moment = require("moment"); // loading moment.js in C:\Program Files\ArangoDB 2.2.4\share\arangodb\js\node\node_modules
controller.get("/hello/:name", function(req, res) {
res.set("Content-Type", "text/plain");
@learncodeacademy
learncodeacademy / gist:5850f394342a5bfdbfa4
Last active January 7, 2024 11:58
SSH Basics - Getting started with Linux Server Administration

###SSH into a remote machine###

ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1

exit: exit ###Install Something###

#If it's a new server, update apt-get first thing
@tamirko
tamirko / replaceInFile.groovy
Created August 5, 2012 11:24
replace string in a file in groovy example
/* Groovy Usage:
The following example replaces:
the 1st occurrence of "James" in data.txt with "user1",
the 2nd occurrence of "James" in data.txt with "user2",
the 3rd occurrence of "James" in data.txt with "user3",
..
the 9th occurrence of "James" in data.txt with "user9".
*/
def myFile = new File("data.txt")