Skip to content

Instantly share code, notes, and snippets.

View nijikokun's full-sized avatar
🍀
working

Niji nijikokun

🍀
working
  • Product Manager
  • San Diego, California
View GitHub Profile
@nijikokun
nijikokun / gist:1042941
Created June 23, 2011 16:38 — forked from cerealcable/gist:1042893
Null tests
import java.util.Map;
public class Main {
static Map<Object,Object> map;
public static void main(String[] args) {
if(map == null) {
System.out.println("test");
}
}
$array = Array(
"class",
"class",
"class"
);
foreach ($array as &$value) {
$$value &= new $value();
}
@nijikokun
nijikokun / sprintf.js
Created July 3, 2011 21:36
Sprintf / Format for Javascript (Java like / PHP like functionality)
/*
* "%s %s %s".format("Format", "For", "Javascript");
* Based on PHPJS sprintf.
*
* @author: Nijikokun <nijikokun@gmail.com>
* @copyright: 2011 (c) Nijikokun
*/
String.prototype.format=function(){var k=arguments,q=0,o=function(b,a,f,c){f||(f=" ");a=b.length>=a?"":Array(1+a-b.length>>>0).join(f);return c?b+a:a+b},m=function(b,a,f,c,g,d){var e=c-b.length;e>0&&(b=f||!g?o(b,c,d,f):b.slice(0,a.length)+o("",e,"0",!0)+b.slice(a.length));return b},n=function(b,a,f,c,g,d,e){b>>>=0;f=f&&b&&{2:"0b",8:"0",16:"0x"}[a]||"";b=f+o(b.toString(a),d||0,"0",!1);return m(b,f,c,g,e)};return this.replace(/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g,
function(b,a,f,c,g,d,e){var i,j;if(b=="%%")return"%";var h=!1;j="";var l=g=!1;i=" ";for(var r=f.length,p=0;f&&p<r;p++)switch(f.charAt(p)){case " ":j=" ";break;case "+":j="+";break;case "-":h=!0;break;case "'":i=f.charAt(p+1);break;case "0":g=!0;break;case "#":l=!0}c=c?c=="*"?+k[q++]:c.charAt(0)=="*"?+k[c.slice(1,-1)]:+c:0;c<0&&(c=-c,h=!0);if
@nijikokun
nijikokun / JSON.java
Created July 5, 2011 03:24
Json Simple Wrapper \o/
import java.util.Arrays;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
/**
* json_simple wrapper by Nijikokun (c) 2011
*/
public class JSON {
private String source;
@nijikokun
nijikokun / css-notes.css
Created July 23, 2011 02:30
CSS & CSS3 Notes, Constantly Used, Very helpful.
/*
* CSS & CSS3 Notepad
*
* These were made for my personal usage, as I constantly use them.
* I have decided to open-source the file.
*
* Some is very useful, other things may be re-dundant.
*
* Once again, these are simply my css notes.
*
@nijikokun
nijikokun / turtles.rb
Created July 24, 2011 04:23
What do you think? I liek turtles. I kinda just edited a example plugin.
# I'm here with Johnathan who just got his face painted and...
# What do you think?
Plugin.is {
name "Turtles"
version "0.1"
author "Nijikokun"
commands :turtle => {
:usage => "/turtle - What do you think?"
}
@nijikokun
nijikokun / rtd.rb
Created July 24, 2011 05:57
Roll the dice for Minecraft RubyBukkit, TF2 style. [VERSION 0.13] (Toxic coming soon...)
# Boring information.
# Its made by @Nijikokun <nijikokun@shortmail.com>
# Copyright (2011)
# AOL License <http://aol.nexua.org>
Plugin.is {
name "Roll The Dice"
main "RTD"
version "0.1"
author "Nijikokun"
commands :rtd => {
@nijikokun
nijikokun / syntax.rb
Created July 28, 2011 21:52
Fake language, based on python, ruby, perl, and java.
# Mockup language by Nijikokun <nijikokun@shortmail.com> (http://twitter.com/nijikokun)
#
# Based on Ruby, Perl, Java, Python
# Minimal Special Chars, Literal strings.
#
# @copyright 2011
# Core imports should be located in "system"
import system
import system.time
@nijikokun
nijikokun / yaml.syntax.js
Created August 8, 2011 02:14
SyntaxHighlighter for YAML
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
*
* @version
* 2.0.320 (July 26 2009)
*
@nijikokun
nijikokun / Common.java.php
Created August 9, 2011 03:51
php.java - Objects ported to PHP for many reasons...
<?php
/**
* Commonly needed functions for some Java -> PHP things to function properly.
*
* @author Nijikokun <nijikokun@shortmail.com>
* @copyright AOL <http://aol.nexua.org>
* @package Common
* @version 1.0.1
* @since p.j1
*/