Skip to content

Instantly share code, notes, and snippets.

@jayrambhia
jayrambhia / bookmark-json.py
Created January 28, 2012 06:52
Fetch Bookmark details from temp files of browsers using json
"""
Created on Fri Jan 27 21:48:58 2012
@author: jay
"""
import json
import os
import gdbm
import time
@jdcrensh
jdcrensh / Base62.java
Last active January 28, 2024 12:25
Class to encode a string into base 62 (character set [a-zA-Z0-9]) with Java. A common use case is URL shortening.
public class Base62 {
public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
public static final int BASE = ALPHABET.length();
private Base62() {}
public static String fromBase10(int i) {
StringBuilder sb = new StringBuilder("");
@JISyed
JISyed / MoveCamera.cs
Last active August 26, 2024 05:45
Camera movement script in Unity3D. Supports rotating, panning, and zooming. Attach to the main camera. Tutorial explaining code: http://jibransyed.wordpress.com/2013/02/22/rotating-panning-and-zooming-a-camera-in-unity/
// Credit to damien_oconnell from http://forum.unity3d.com/threads/39513-Click-drag-camera-movement
// for using the mouse displacement for calculating the amount of camera movement and panning code.
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
//
// VARIABLES
@scobal
scobal / draw_table
Created July 31, 2013 19:40
Pdfbox table with line wrapping and custom column widths
private void drawTable(PDPage page, PDPageContentStream contentStream, float y, float margin, String[][] content, float[] colWidths) throws IOException {
final int rows = content.length;
final int cols = content[0].length;
final float rowHeight = 40f;
final float tableWidth = page.findMediaBox().getWidth() - margin - margin;
final float tableHeight = rowHeight * rows;
final float colWidth = tableWidth/(float)cols;
final float cellMargin=5f;
@cliss
cliss / organize-photos.py
Created October 6, 2013 14:43
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@JISyed
JISyed / MoveCameraInertia.cs
Last active August 31, 2022 09:26
Similar to MoveCamera.cs (https://gist.github.com/JISyed/5017805), except with inertia. This makes the camera gradually come to a smooth stop when stopping the camera movement.
// Credit to damien_oconnell from http://forum.unity3d.com/threads/39513-Click-drag-camera-movement
// for using the mouse displacement for calculating the amount of camera movement and panning code.
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
//
@andre-morassut
andre-morassut / Readme.md
Last active August 14, 2021 19:48
Sublime Text - Text highlighting for writers

Sublime Text - Text highlighting for writers

What is it

A syntax definition for Sublime Text.

Not intened for a programming language but for prose writing. This enables :

  • highlighting for dialogs in a novel
  • Sections and titles highlights
  • Notes highlights
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active November 27, 2024 13:36
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

using UnityEngine;
using UnityEngine.EventSystems;
namespace UnityEngine.EventSystems
{
public class MultiTouchInputModule : PointerInputModule
{
private PinchEventData _pinchData;
private RotateEventData _rotateData;
@MatthewSteeples
MatthewSteeples / mousemove.ps1
Created February 26, 2015 19:09
Powershell Script to keep the mouse moving
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
$Pos = [System.Windows.Forms.Cursor]::Position
$x = ($pos.X % 500) + 1
$y = ($pos.Y % 500) + 1
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Seconds 10
}