Skip to content

Instantly share code, notes, and snippets.

View maddievision's full-sized avatar
always sparkly

maddie lim ✨ maddievision

always sparkly
View GitHub Profile
@maddievision
maddievision / AlertPrompt.m
Created March 9, 2011 09:56
UI Alert View with Prompt
// taken from
// http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html
/*
Alert View with Prompt
Here's another generic class for you. This one doesn't require a navigation app - it can be used pretty much anywhere. It's a custom-subclass of UIAlertView that lets the user type in a value. It supports only two buttons - Okay and Cancel - but it handles everything to do with the text field for you. It looks like this:
*/
@maddievision
maddievision / DateFunction.xll
Created March 14, 2011 22:28
Date Functions for Excel and VBA
(Excel Versions)
NearestWeekEnding:
=IF(WEEKDAY(TODAY())<=4,TODAY()-(WEEKDAY(TODAY()-1)),TODAY()+(8-WEEKDAY(TODAY())))
WeekEndingDate(inputcell,weindex):
inputcell = input date
weindex = day of week which is the end (1 = sunday, 7 = saturday)
=INT(IF(WEEKDAY(inputcell)=weindex,inputcell,IF(WEEKDAY(inputcell)>weindex,7,0)+inputcell+weindex-WEEKDAY(inputcell)))
@maddievision
maddievision / gist:882134
Created March 22, 2011 21:36
Socks SSH and SSH Agent
export GIT_SSH="${HOME}/bin/socks-ssh"
#taken from http://mah.everybody.org/docs/ssh#run-ssh-agent
#credit Joseph M. Reagle http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
@maddievision
maddievision / DateMath.cs
Created September 20, 2011 05:39
AddWorkingDays C# With Holidays Support
using System;
using System.Collections.Generic;
using System.Text;
namespace ReportAutomation
{
public static class DateMath
{
public static DateTime AddWorkingDays(this DateTime input, int interval, List<DateTime> holidays = null)
{
@maddievision
maddievision / gist:1624759
Created January 17, 2012 04:43
Insert current date and/or time, for Sublime
import sublime, sublime_plugin, datetime
#supports multiple selections/cursors
def replace_sel(view,edit,text):
s = set()
for r in view.sel():
view.replace(edit, r, text)
e = r.begin()+text.__len__()
s.add(sublime.Region(e,e))
@maddievision
maddievision / lazyboosh.py
Created August 26, 2012 10:08
lazyboosh v0.01
"""
LAZYBOOSH HOW TO USE
1. Notify channel when it will be (all the /c*** commands change the topic)
/cno <min> - eg /cno 30
2. Start the compo (also open it in s3m.it)
/cstart <sample pack url> - eg /cstart https://dl.dropbox.com/u/3434534/lolpack.it
3. Don't forget to make your own entry, too
4. Notify when due
/cdue
@maddievision
maddievision / wk.py
Last active December 10, 2015 09:19
Wanikani messy Python
WK_API_KEY = 'dick' #API key which will be used for general stuff
import requests, datetime, time, pytz, romkan
WK_CACHE_TIME = 10 * 60
WK_MAX_LEVEL = 25
WK_ALL_LEVELS = [x+1 for x in xrange(WK_MAX_LEVEL)]
WK_API_URL = 'http://www.wanikani.com/api/user/%s/%s/%s'
WK_UTC = pytz.utc
@maddievision
maddievision / NSString+WhitespaceUtil.m
Created January 2, 2013 00:27
NSString+WhitespaceUtil.m
+ (NSString*) stringByCompactingWhitespaces:(NSString*) theString {
return [[[theString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF != ''"]] componentsJoinedByString:@" "];
}
@maddievision
maddievision / gist:4993735
Created February 20, 2013 07:47
hello pork
print "hello, pork"
print "roll"
@maddievision
maddievision / pyIT.py
Last active December 14, 2015 03:18
pyIT
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""\
Python module for handling Impulse Tracker files.
(c) 2008 mike burke / mrb / [email protected]
doesn't and won't handle old format IT instruments (cmwt < 0x200),