Skip to content

Instantly share code, notes, and snippets.

@marcojahn
marcojahn / gist:0422ee7b1a7acfcec27d0a11e001cb61
Last active September 21, 2018 12:35
udemy full course download
The following will:
1. download to the folder you are running the command from
2. run on windows
3. put a sequential number in front of each course title 001-999
You will need to
1. put in your uDemy email address
2. put in your uDemy password
3. replace the example url at the end of this code snippet with one you've purchased
@marcojahn
marcojahn / objectdeepcopy.js
Created August 15, 2018 12:07 — forked from izy521/objectdeepcopy.js
`JSON.parse( JSON.stringify( obj) )` has been regarded as the fastest method for deep copying Objects, but is it? This is mainly just to test. Obviously Functions aren't allowed in JSON.
var Types = new Map();
Types.set(Array, function(v) {
var l = v.length; i = 0, a = Array(l);
for (i; i<l; i++) {
a[i] = v[i];
}
return a;
});
Types.set(Number, function(v) {
return v * 1;
@marcojahn
marcojahn / after.scenario.js
Created May 22, 2018 05:38 — forked from wswebcreation/after.scenario.js
Setup for attaching the difference to the Cucumber report file. This can be used with Protractor + CucumberJS + protractor-image-comparison
import { After, Status } from 'cucumber';
import { resolve } from 'path';
const fs = require('fs');
const diffFolder = resolve(process.cwd(), '.tmp/report/screenshots/image-comparison/diff/');
const screenshotFolder = resolve(process.cwd(), '.tmp/screenshots/');
/**
* The After hook that checks the scenario status and creates a
* screemshot if needed
@marcojahn
marcojahn / highsierra_bootable.sh
Created January 12, 2018 09:53 — forked from agentsim/highsierra_bootable.sh
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
@marcojahn
marcojahn / raspi-monitor
Created August 10, 2017 09:14 — forked from simlun/raspi-monitor
Script to enable and disable the HDMI signal of the Raspberry PI
#!/bin/bash -e
# /usr/local/sbin/raspi-monitor
# Script to enable and disable the HDMI signal of the Raspberry PI
# Inspiration: http://www.raspberrypi.org/forums/viewtopic.php?t=16472&p=176258
CMD="$1"
function on {
/opt/vc/bin/tvservice --preferred
@marcojahn
marcojahn / HOCBaseRender.tsx
Created June 9, 2017 11:53 — forked from tejacques/HOCBaseRender.tsx
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
public final class CompanyWrapper<T> {
private T t;
public CompanyWrapper() { }
public CompanyWrapper(T t) {
this.t = t;
}
-----------------------------------------------------------------------------------
Language files blank comment code
-----------------------------------------------------------------------------------
Java 1681 36675 21114 173048
CSS 115 2724 874 15181
Maven 34 378 362 8326
XML 86 708 390 7360
Javascript 3 532 826 3209
HTML 41 164 528 608
Visualforce Component 5 0 0 33
$ openssl pkcs7 -inform der -in /Applications/DaisyDisk.app/Contents/_MASReceipt/receipt -print_certs -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
18:59:43:21:72:74:9c:fc
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=US, O=Apple Inc., OU=Apple Worldwide Developer Relations, CN=Apple Worldwide Developer Relations Certification Authority
Validity
Not Before: Nov 11 21:58:01 2010 GMT
// load underscore from browser console
$.get('https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js');
// execute the following code
function getScopes(root) {
var scopes = [];
function traverse(scope) {
scopes.push(scope);
if (scope.$$nextSibling)
traverse(scope.$$nextSibling);