Skip to content

Instantly share code, notes, and snippets.

View mig82's full-sized avatar
🏠
Working from home

Miguelángel Fernández mig82

🏠
Working from home
View GitHub Profile
@mig82
mig82 / mapToArray.js
Last active February 5, 2020 10:08
A Javascript post-processor for Fabric which converts a property from an object into an array of objects.
/*
* Convert something like mymap: {foo: 0, bar: 1, qux:2} into
* myarr: [{foo: 0}, {bar: 1}, {qux:2}] */
function mapToArray(propName){
var res = resultToJSON(result);
var map = res[propName];
var array = [];
for(r in map){
var obj = {};
obj[r] = map[r];
@mig82
mig82 / lintconfig.js
Last active November 27, 2020 10:38
EsLint config for Vis Quantum
/* AUTO GENERATED CONTENT */
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
module.exports = mod();
else if (typeof define == "function" && define.amd) // AMD
return define([], mod);
else // Plain browser env
return mod();
})(function() {
initGettersSetters: function() {
//Field foo
defineGetter(this, "foo", () => {return this._foo;});
defineSetter(this, "foo", (foo) => {this._foo = foo;});
//Field bar
defineGetter(this, "bar", () => {return this._bar;});
defineSetter(this, "bar", (bar) => {this._bar = bar;});
}
@tzmartin
tzmartin / embedded-file-viewer.md
Last active October 25, 2024 02:37
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

#!/usr/bin/ruby
require 'xcodeproj'
# ============================================
# !!! I've released a ruby gem that does the same thing, but better.
# You can install it by running `gem install xcprovisioner` or
# `sudo gem install xcprovisioner` if it asks for sudo rights.
#
# For more info: https://github.com/thelvis4/XCProvisioner
@abhiomkar
abhiomkar / LateBinding.js
Created September 18, 2015 10:42
Early Binding & Late Binding in JavaScript
// Early Binding vs Late Binding
// Early Binding
var sum = function(a, b) {
return a + b;
};
var x = 5, y = 6;
var sum5n6 = sum.bind(null, x, y);
@evanscottgray
evanscottgray / portfinders.zsh
Created January 14, 2015 00:52
put this in your $shellrc and enjoy
# Find ALL the port users. _o/
findbyport() {
lsof -nP | grep ":$@" | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'
}
portsinuse() {
lsof -nP | grep "IPv" | while read line; do echo $line | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'; echo; done;
}
@aubricus
aubricus / setup_snippet.py
Created February 24, 2014 08:48
Use pandoc to convert README.md into .rst for Pypi
long_description = ''
try:
import subprocess
import pandoc
process = subprocess.Popen(
['which pandoc'],
shell=True,
stdout=subprocess.PIPE,
@stuart-warren
stuart-warren / CreateJob.sh
Last active March 8, 2024 16:20
Create a job in Jenkins (or folder) using the HTTP API
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder