Skip to content

Instantly share code, notes, and snippets.

Unary operators

(and the oddities of number evaluation in JavaScript)

Type conversion, typecasting, and coercion are different ways of, implicitly or explicitly, changing an entity of one data type into another. [--wikipedia][wikipedia]


Unary operators, or "typeof +'foo' === huh?"

import urllib
import urllib2
# Citadel Backconnect Server 1.3.5.1 Remote Code Execution vulnerability
# Work only on windows box
def request(url, params=None, method='GET'):
if method == 'POST':
urllib2.urlopen(url, urllib.urlencode(params)).read()
elif method == 'GET':
@ryboe
ryboe / bad_css
Last active May 14, 2025 17:22
Non-standard and Obsolete CSS Properties
OBSOLETE PREFIXES
-xv-interpret-as // -xv- and -o- are old Opera prefixes for the Presto
-xv-phonemes // engine. Opera switched to the Blink engine with
-xv-voice-balance // version 15. The current version is 34.
-xv-voice-duration
-xv-voice-pitch
-xv-voice-pitch-range
-xv-voice-rate
-xv-voice-stress
-xv-voice-volume
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active February 25, 2025 22:09
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@netzwahnHH
netzwahnHH / column-classes
Last active August 29, 2015 14:04
Sass adaption of "Bootstrap v3.2 optional responsive CSS classes"
// Generate optional visibility layout classes for the different viewports of Bootstrap
// Sass adaption of Bootstrap v3.2 optional responsive CSS classes https://gist.github.com/webtobesocial/2f3d9254e696336a083b#file-column-classes-css
@mixin optional-viewport-only-column($visibilty-class) {
@for $i from 1 through 12 {
.col-#{$visibilty-class}-#{$i}-only {
width: (($i/12)*100) * 1%;
}
}
}
@learncodeacademy
learncodeacademy / gist:ebba574fc3f438c851ae
Created July 24, 2014 14:47
Nginx Node Frontend / Load Balancer / Static Assets Caching
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {
@bengolder
bengolder / bash_commands.sh
Last active July 10, 2016 15:31
some useful bash commands that I only use occasionally
# checkout where a network connection is routed
traceroute [some address]
# see all the user accounts
cat /etc/passwd
# see all the processes
ps aux
# see running processes
@sheharyarn
sheharyarn / mongo_backup.sh
Last active December 12, 2024 15:16
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@thde
thde / whois.conf
Last active January 17, 2025 07:43
/etc/whois.conf WHOIS records for nTLDs.
##
# WHOIS servers for new TLDs (http://www.iana.org/domains/root/db)
# Current as of 2017-12-10 UTC
##
\.aarp$ whois.nic.aarp
\.abarth$ whois.afilias-srs.net
\.abbott$ whois.afilias-srs.net
\.abbvie$ whois.afilias-srs.net
\.abc$ whois.nic.abc