Skip to content

Instantly share code, notes, and snippets.

View Naddiseo's full-sized avatar

no Naddiseo

  • n/a
  • earth
View GitHub Profile
@Naddiseo
Naddiseo / request.mithril.js
Last active August 29, 2015 14:06
ES6 Promise version of Mithril's request function
m.request = function(xhrOptions) {
var deferred = m.deferred()
var serialize = xhrOptions.serialize = xhrOptions.serialize || JSON.stringify
var deserialize = xhrOptions.deserialize = xhrOptions.deserialize || JSON.parse
var extract = xhrOptions.extract || function(xhr) {
return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText
}
xhrOptions.onload = xhrOptions.onerror = function(e) {
e = e || event
var unwrap = (e.type == "load" ? xhrOptions.unwrapSuccess : xhrOptions.unwrapError) || identity
@Naddiseo
Naddiseo / Player.cs
Created September 4, 2013 04:12
Unity PC/Ouya FPS manager
using System;
using System.Collections.Generic;
using UnityEngine;
class Player : MonoBehaviour {
public PlayerSettings settings = new PlayerSettings();
public TextMesh tooltip = null;
PlayerInputManager input = null;
#region Player State
var prototypeOfArray = Array.prototype;
var prototypeOfObject = Object.prototype;
var _Array_slice_ = prototypeOfArray.slice;
var array_splice = Array.prototype.splice;
ArraySplice = function(start, deleteCount) {
var result
, args = _Array_slice_.call(arguments, 2)
, addElementsCount = args.length
;
@Naddiseo
Naddiseo / pyspace.pl
Last active December 20, 2015 19:58
$ cat .gitattributes *.py filter=pyspace $ cat .gitconfig [filter "pyspace"] smudge = cat clean = pyspace.pl --file %f required
#!/usr/bin/perl
use strict;
use warnings;
use 5.10.0;
use Getopt::Long;
use Data::Dumper;
my $filename;
my $line_count = 0;
@Naddiseo
Naddiseo / bulk_class_edit.js
Last active December 19, 2015 16:59
This jquery plugin allows bulk editing of classes on elements. Use like: $('#myelement').changeClass('+one -two !three'); This unconditionally adds class `one`, unconditionally removes class `two`, and toggles class `three`
/*
//@ sourceURL=static/js/lib/jquery.hacks.js
*
* from https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
*/
(function(factory) {
if ( typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@Naddiseo
Naddiseo / crypt_pub.pl
Last active December 14, 2015 17:59
A script for encrypting part of a file before committing to git. Useful for storing passwords encrypted on places like github, but having the plaintext available locally. Requirements: gpg, perl >=5.14
#!/usr/bin/perl
#A script for encrypting part of a file before committing to git.
#Useful for storing passwords encrypted on places like github, but having the plaintext available locally.
#
#Requirements: gpg, perl >=5.14
#
#Usage:
#- Create a gpg key for encrypting, passwordless.
#- Make sure crypt_pub.pl is executable and in $PATH
#- In your .git/config place:
@Naddiseo
Naddiseo / gist:2955155
Created June 19, 2012 16:35
Django shell completion for 'manage' alias
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
diff --git a/java2python/compiler/visitor.py b/java2python/compiler/visitor.py
index 3b55e31..4ac6315 100644
--- a/java2python/compiler/visitor.py
+++ b/java2python/compiler/visitor.py
@@ -470,7 +470,8 @@ class MethodContent(Base):
if len(children) == 3:
nextNode = children[2]
nextType = nextNode.type
-
+
from __future__ import division
import codecs,sys
from itertools import combinations, chain, permutations
from phonics import PHONEMES, phoneme as p, \
Vowel, Consonant, Articulation as A, Position
art_pn = [A.PLOSIVE, A.NASAL]
art_al = [A.APPROX, A.LATERAL]
art_fp = [A.FRICATIVE, A.PLOSIVE]