Skip to content

Instantly share code, notes, and snippets.

View progress44's full-sized avatar
Drinking coffee

Ani Sinanaj progress44

Drinking coffee
View GitHub Profile
@aaronabentheuer
aaronabentheuer / Implementing Rounded Corners in iOS
Created September 15, 2014 12:00
Screens are Rounded Rectangles.
// AppDelegate.swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var activeCornerRadius : Int = 6
var incativeCornerRadius : Int = 0
@gtramontina
gtramontina / mac-functions
Created September 4, 2014 06:59
brew_cask_install
brew_cask_install() {
if ! brew_cask_is_installed "$1"; then
brew cask install "$@"
fi
}
brew_cask_is_installed() {
local NAME=$(brew_cask_expand_alias "$1")
brew cask list -1 | grep -Fqx "$NAME"
}
@lastguest
lastguest / parseStyle.js
Last active October 12, 2016 09:12
Parse Style Runs from HTML string
"use strict";
var test = '<b style="color:#fff; background: red">He<i>ll</i>o </b><u>Wo<i>rld</i></u>';
function parseStyle(text){
// Patterns and temp strings
var tags_rx = /<\s*(\/?\s*[^>]+)(\s+[^>]+)?\s*>/gm,
css_rx = /([\w-]+\s*:\s*[^\n;"']+)/gm,
partial, tag, css, temp_style;

Titanium reminders for boooooooring operations (OSX only)

Android

Generate the keystore

keytool -genkeypair -v -keystore keystore -keyalg RSA -sigalg SHA1withRSA -validity 10000
@glnds
glnds / logstash.conf
Last active December 5, 2019 14:13
Logstash Glassfish server.log config
# Logstash config for Glassfish logs
# Used in combination with slf4j and logback
# Output:
# - application: glassfish
# - type: application or internal
# - categorie: technical or functional
input {
# If running logstash under a different user then check your permission to be sure that
@amowu
amowu / GetStreamingAssetsPath.cs
Created December 25, 2013 08:24
Get Unity StreamingAssets file path with Android and iOS.
// Put your file to "YOUR_UNITY_PROJ/Assets/StreamingAssets"
// example: "YOUR_UNITY_PROJ/Assets/StreamingAssets/db.bytes"
string dbPath = "";
if (Application.platform == RuntimePlatform.Android)
{
// Android
string oriPath = System.IO.Path.Combine(Application.streamingAssetsPath, "db.bytes");

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@evgenius
evgenius / onchange.sh
Last active December 15, 2018 22:17 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@jirutka
jirutka / analytics.conf
Created March 31, 2013 01:03
Add Google Analytics tracking code to HTML via nginx
#
# Add Google Analytics tracking code to HTML response
#
# Usage:
# set $tracking_id 'UA-12345678-9';
# include incl/analytics.conf;
#
# It needs nginx compiled with option --with-http_sub_module.
# Uses optimized GA code from: http://mathiasbynens.be/notes/async-analytics-snippet
#
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)