Skip to content

Instantly share code, notes, and snippets.

@mminer
mminer / Console.cs
Last active March 28, 2024 22:23
Unity script to display in-game debug console. Actively maintained version: https://github.com/mminer/consolation
// NOTE: For an actively-maintained version of this script, see https://github.com/mminer/consolation.
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A console to display Unity's debug logs in-game.
/// </summary>
public class Console : MonoBehaviour
{
@tvandervossen
tvandervossen / gist:1231476
Created September 21, 2011 07:33
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@douglas
douglas / update_git_repos.sh
Created October 14, 2011 15:04
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@mogya
mogya / gist:3781468
Created September 25, 2012 12:24
An idea to convert dp to/from pixel on TitaniumMobile Android
// convert dp to pixel.
function dpToPixel(dp) {
return ( parseInt(dp) * (Titanium.Platform.displayCaps.dpi / 160));
}
// convert pixel to dp.
function pixelToDp(px) {
return ( parseInt(px) / (Titanium.Platform.displayCaps.dpi / 160))+'dp';
}
@jpbochi
jpbochi / underscore_groupby_with_selector.js
Created September 26, 2012 02:34
underscore.js extended groupBy with value selector
// The code below will extend underscore.js adding the groupByAndMap function.
// groupByAndMap works like the regular groupBy, but it accepts an optional third "selector" argument.
// The 'selector' is used to select values inside each group.
// As usual in underscore, you can either pass a function or a string with the name of an attribute you want.
// groupByAndMap is useful when you don't want the key to be present in the values inside the group.
// Also, it completely covers the groupBy functionality because the last argument is optional.
// If you want, you can replace groupBy instead of defining a new function.
_.mixin({
groupByAndMap: function(list, keySelector, valueSelector) {
@anointed
anointed / multi-ipn.php
Created September 30, 2012 02:42
Paypal multiple IPN's
<?php
/*
* This is a PayPal IPN (Instant Payment Notification) broadcaster
* Since PayPal does not provide any straightforward way to add
* multiple IPN listeners we'll have to create a central IPN
* listener that will broadcast (or filter and dispatch) Instant
* Payment Notifications to different destinations (IPN listeners)
*
* http://codeseekah.com/2012/02/11/how-to-setup-multiple-ipn-receivers-in-paypal/
*
@petenelson
petenelson / custom-permalink-from-meta.php
Created November 5, 2012 21:32
WordPress permalink for custom post type based on post meta
@iMagdy
iMagdy / node_apache.apacheconf
Last active February 25, 2020 00:46
This virtualhosts snippet will make your nodejs app run on the traditional port 80, so mynodeapp.com:3000 will simply work on mynodeapp.com without adding :3000. it's that simple :) remember to enable apache modules proxy and proxy_http ($ sudo a2enmod proxy && sudo a2enmod proxy_http)
<VirtualHost *:80>
ServerAdmin isl@m.magdy
ServerName js.io
ServerAlias js.io
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
@jshawl
jshawl / Gruntfile.js
Last active January 18, 2023 13:52
Grunt + Sass + Autoprefixer
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options:{
style:'compressed'
},
files: {
'css/style.css' : 'scss/style.scss'