Skip to content

Instantly share code, notes, and snippets.

View dashersw's full-sized avatar

Armagan Amcalar dashersw

View GitHub Profile
@dashersw
dashersw / getdomcount.js
Created September 26, 2011 08:36
get dom element counts by tag name with jquery
var tags = {};
$("*").each(function(item) {
if (!tags[this.tagName])
tags[this.tagName] = 0;
tags[this.tagName]++;
});
tags;
@dashersw
dashersw / index.html
Last active December 31, 2015 09:29
Prevent rubber band scrolling on iOS Safari (tested on iOS 6 & 7)
<!DOCTYPE html>
<html>
<head>
<title>Look ma, no rubber-banding!</title>
<style>
html, body {
height: 100%;
font-size: 42px;
padding: 0;
margin: 0;
#!/bin/sh
# Installs tarsnap client on Debian and Ubuntu
#
# You'll need to setup an account at
# http://www.tarsnap.com
# and load it with some funds
#
# Make sure you run this as root
#
@dashersw
dashersw / FizzBuzz.java
Created June 23, 2015 23:21
Simple FizzBuzz in Java
public class FizzBuzz {
public static void main(String[] args) {
for (int i = 1; i < 100; i++) {
String output = "";
if (i % 3 == 0) output += "Fizz";
if (i % 5 == 0) output += "Buzz";
System.out.println(output.isEmpty() ? i : output);
}
}
@dashersw
dashersw / xcode-build-bump.sh
Created November 12, 2015 11:02 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@dashersw
dashersw / conversion-client.js
Created May 8, 2017 22:33
Hassle-free microservices with cote.js — conversion-client.js step 1
const cote = require('cote');
@dashersw
dashersw / conversion-client.js
Created May 8, 2017 22:35
Hassle-free microservices with cote.js — conversion-client.js step 2
const requester = new cote.Requester({ name: 'currency conversion requester' });
@dashersw
dashersw / conversion-client.js
Created May 8, 2017 22:37
Hassle-free microservices with cote.js — conversion-client.js step 3
const request = { type: 'convert', from: 'usd', to: 'eur', amount: 100 };
requester.send(request, (res) => {
console.log(res);
});
@dashersw
dashersw / conversion-client.js
Created May 8, 2017 22:41
Hassle-free microservices with cote.js — conversion-client.js
const cote = require('cote');
const requester = new cote.Requester({ name: 'currency conversion requester' });
const request = { type: 'convert', from: 'usd', to: 'eur', amount: 100 };
requester.send(request, (res) => {
console.log(res);
});
@dashersw
dashersw / conversion-service.js
Last active May 14, 2017 20:18
Hassle-free microservices with cote.js — conversion-service.js step 2
const rates = { usd_eur: 0.91, eur_usd: 1.10 };
responder.on('convert', (req, cb) => { // ideally, you would sanitize your input here.
cb(req.amount * rates[`${req.from}_${req.to}`]);
});