This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function valueFromObjectPath(obj, path) { | |
var steps = path.split(/\//); | |
var val = obj; | |
while (steps.length) { | |
var key = steps.shift(); | |
if (typeof(val[key]) !== 'undefined') { | |
val = val[ key ]; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
file = File.read("dirty.xml") | |
xml = Nokogiri::XML(file) | |
# xml.xpath("//location").each do |node| | |
# node.content = node.content.gsub(/\n\s+/, " ") | |
# end | |
File.open("clean.xml", "w") do |f| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .local/share/applications/eclipse.desktop | |
[Desktop Entry] | |
Type=Application | |
Name=Eclipse | |
Comment=Eclipse Integrated Development Environment | |
Icon=/opt/eclipse/icon.xpm | |
Exec=/opt/eclipse/eclipse | |
Terminal=false | |
Categories=Development;IDE;Java; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Type=Application | |
Name=Android Studio | |
Comment=Android Studio Integrated Development Environment | |
Icon=/opt/android-studio/bin/androidstudio.ico | |
Exec=/opt/android-studio/bin/studio.sh | |
Terminal=false | |
Categories=Development;IDE;Java;Android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function listServices(mod, r) { | |
var inj = angular.element(document).injector().get; | |
if (!r) { | |
r = {}; | |
} | |
angular.forEach(angular.module(mod).requires, | |
function(m) { | |
listServices(m,r) | |
}); | |
angular.forEach(angular.module(mod)._invokeQueue, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setInterval( | |
function() { | |
Array.prototype.slice.call( | |
document.querySelectorAll('[data-reactid]') | |
).forEach(function(element) { | |
element.style.background = 'rgba(255,0,0,0.1)'; | |
}); | |
}, 500 | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(HistData) | |
galton <- Galton | |
y <- galton$child | |
x <- galton$parent | |
freqData <- as.data.frame(table(galton$child, galton$parent)) | |
names(freqData) <- c("child", "parent", "freq") | |
plot(as.numeric(as.vector(freqData$parent)), | |
as.numeric(as.vector(freqData$child)), | |
pch = 21, col = "black", bg = "lightblue", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | |
# Try to load via project-specific .nvmrc | |
nvm use > /dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
# Use default - set with 'nvm alias default v0.12.1' | |
nvm use default | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: playframework | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/Stop playframework | |
### END INIT INFO | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var escodegen = require('escodegen'); | |
var parse = require("esprima").parse; | |
var fs = require("fs"); | |
var src = fs.readFileSync( | |
"test.js", | |
"utf-8" | |
); | |
var ast = parse(src); |