Skip to content

Instantly share code, notes, and snippets.

made you look

andreas andreasvirkus

made you look
View GitHub Profile
# Just some examples of how to do file validation with javascript
# IS NOT BULLETPROOF and should be coupled with server side validation
# But, it can help
validate_file = ->
file = @fileInput.files[0]
if "name" of file
name =
name = file.fileName
if "size" of file
siggiarni / Password-Fields.css
Created Apr 14, 2014
The only font that emulate correctly the password field's big dots of other browsers is Verdana.See:
View Password-Fields.css
font: large Verdana,sans-serif;
letter-spacing: 1px;
lambtron / sorter.js
Created Oct 20, 2015
Custom sort method for metalsmith-collections plugin in Segment's technical documentation.
View sorter.js
* Generate a custom sort method for given starting `order`. After the given
* order, it will ignore casing and put periods last. So for example a call of:
* sorter('Overview');
* That is passed:
* - Analytics.js
ianaya89 / ajax.js
Created Jan 22, 2015
Ajax request with Vanilla JS
View ajax.js
function ajax(type, url) {
var request = new XMLHttpRequest();, url, true);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
var resp = this.response;
else {
nebirhos / jquery.ajax.progress.js
Created Oct 15, 2012 — forked from db/jquery.ajax.progress.js
add XHR2 upload and download progress events to jQuery.ajax
View jquery.ajax.progress.js
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function" && that.progress !== undefined) {
req.addEventListener("progress", function(evt) {
}, false);
fedemp / index.markdown
Created Apr 12, 2012
Running Windows under Ubuntu to test in Internet Explorer
View index.markdown

How to test Internet Explorer 6 to 9 in Ubuntu

The final purpose of this tutorial is to have a Windows (XP, Vista, 7) running a native installation of Internet Explorer (6, 7, 8, 9). Windows will work as a guest in on Virtualbox running on Ubuntu. We will also make sure to have access to virtual hosts configured in the host OS.

Following steps have to be run on Ubuntu (or whatever flavor of Linux you have)

Download disk images of Windows

First step is to download Windows Virtual PC VHDs for testing websites with different Internet Explorer versions . These disk images are installations of different Windows versions with Internet Explorer installed. It's perfectly legal to use to any of these images; free as in beer.

Once you have download them, you will find that they are RAR files and one of them is an .exe file. Just rename the .exe file to .rar and we can continue.

jtsternberg / cmb-toggle-fields.css
Last active May 11, 2017
hidden-toggle for cmb. Works like the WordPress metabox toggle (but for only a selection of fields)
View cmb-toggle-fields.css
.advanced-toggle .toggle-label {
cursor: pointer;
display: block;
line-height: 3em;
border-bottom: 1px solid #e9e9e9;
border-left: 1px solid #e9e9e9;
border-right: 1px solid #e9e9e9;
padding-left: .8em;
.advanced-toggle .inside .cmb-row {
View node-wpapi-oauth-option1.js
var WPAPI = require( 'wpapi' );
var wp = new WPAPI({
endpoint: endpointUrl,
oauth: {
clientId: clientId,
clientSecret: clientSecret,
callback: callbackUrl // optional: (defaults to oob)
danielpataki / Vagrantfile
Last active Feb 23, 2019
WordPress On Vagrant
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "precise64"
config.vm.box_url = "" :private_network, ip: ""
View longpress-directive.js
Vue.directive('longpress', {
bind: function (el, binding, vNode) {
// Make sure expression provided is a function
if (typeof binding.value !== 'function') {
// Fetch name of component
const compName =
// pass warning to console
let warn = `[longpress:] provided expression '${binding.expression}' is not a function, but has to be`
if (compName) { warn += `Found in component '${compName}' ` }