Skip to content

Instantly share code, notes, and snippets.

**opposite sets of each of these metacharacters by using their upper case letters**
\ escape char after
\d 0-9
\D represents any non-digit character
\w alphanumeric letters and digits
\W any non-alphanumeric character (such as punctuation)
\b which matches the boundary between a word and a non-word character.
\. match single char (letter/digit/whitespace), wildcard
[] match any single char within [] will pass
[^] not to match any within [], excludes specific char
before install rvm, install the mpapis public key.
$brew install gnupg gnupg2
$gpg --keyserver hkp://keys.gnupg.net
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
follow rvm website
test: rvm list / rvm use *.*.* / ruby -v
The function object has a length property set to the number of formal parameters it is declared with.
In JavaScript, variables don't have types -- values have types.
The typeof operator always returns a string
Variables that have no value = "undefined", an "undeclared" variable is one that has not been formally declared in the accessible scope.
The typeof operator returns "undefined" even for "undeclared" (or "not defined") variables
let a = 13.6 | 0;[ floor float numbers]
All bitwise operations except unsigned right shift, >>>, work on signed 32-bit integers. So using bitwise operations will
convert a float to an integer. - slightly faster than Math.floor - 32-bit signed integers only
npm view webpack versions ------ list all versions
npm show webpack version ------ list latest version
webpack 1 vs 2
- 2 handles ex6 imports
run webpack
./node_modules/webpack/bin/webpack.js <input file> <output file>
in package.json, do:
git log --graph
git log --graph --decorate --oneline
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s"
The websocket communication relies on the client-server logic, where a persistent connection between a server
and a client always exists.
the server opens a dedicated port where clients get connected. once happens, all connected app can send outgoing message to port and listen
to it for incoming message without additional requset.
IEEE 802.11 Radiotap Capture header (radiotap)
radiotap.antenna Antenna
Unsigned 32-bit integer
Antenna number this frame was sent/received over (starting at 0)
radiotap.channel Channel
Unsigned 32-bit integer
802.11 channel number that this frame was sent/received on
radiotap.channel.freq Channel frequency
If this json file won't become too big over the time you should try:
Create a javascript object with the table array in it
var obj = {
table: []
};
Add some data to it like
obj.table.push({id: 1, square:2});
Convert it from an object to string with stringify
var json = JSON.stringify(obj);
scanning devices within wifi area
http://www.libelium.com/products/meshlium/smartphone-detection/
• The MAC address of the wireless interface, which allows to identify it uniquely.
• The strength of the signal (RSSI), which gives us the average distance of the device from the scanning point.
• The vendor of the smartphone (Apple, Samsung, etc)
• The WiFi Access Point where the user is connected (if any) and the Bluetooth friendly name. Users not connected to an AP will be showed as "free users".
• The Class of Device (CoD) in case of Bluetooth which allows us to differentiate the type of device (smartphone, handsfree, computer, LAN/network AP). With this parameter we can differentiate among pedestrians and vehicles.
@ruichuang
ruichuang / JS
Last active April 10, 2017 03:08
unary plus +
The unary plus operator precedes its operand and evaluates to its operand but attempts to convert it into a number
+3 // 3
+'3' // 3
+true // 1
+false // 0
+null // 0
+function(val){ return val } // NaN