(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// hasClass, takes two params: element and classname | |
function hasClass(el, cls) { | |
return el.className && new RegExp("(\\s|^)" + cls + "(\\s|$)").test(el.className); | |
} | |
/* use like below */ | |
// Check if an element has class "foo" | |
if (hasClass(element, "foo")) { |
require 'csv' | |
require 'open-uri' | |
require 'nokogiri' | |
file = "keepass.xml" | |
doc = Nokogiri::XML::Document.parse(open(file)) do |config| | |
config.noblanks | |
end ; nil |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/bash | |
files=$(git diff --cached --name-only | grep '\.js$') | |
# Prevent ESLint help message if no files matched | |
if [[ $files = "" ]] ; then | |
exit 0 | |
fi | |
echo $files | xargs eslint |
For some extra awesomeness replace a javascript file with a js file from dropbox with ?dl=1 at the end of the js url. Now you can modify the file locally, it will update itself, and you just have to refresh the browser. Pretty cool!
import { mockServer, MockList } from 'graphql-tools'; | |
import casual from 'casual-browserify'; | |
// The GraphQL schema. Described in more detail here: | |
// https://medium.com/apollo-stack/the-apollo-server-bc68762e93b | |
const schema = ` | |
type User { | |
id: ID! | |
name: String |
Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.
The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from
Adam Carbonell has created a non-malicious extension, called "Get CRX": https://chrome.google.com/webstore/detail/get-crx/dijpllakibenlejkbajahncialkbdkjc
Google has removed the original extension, along with several other extensions with similar malware.
Relavant links:
function convertToCSV(objArray) { | |
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; | |
var str = ''; | |
for (var i = 0; i < array.length; i++) { | |
var line = ''; | |
for (var index in array[i]) { | |
if (line != '') line += ',' | |
line += array[i][index]; |