Skip to content

Instantly share code, notes, and snippets.

@Alligator
Alligator / 0-README.md
Last active February 2, 2021 12:28
palindrome permutations

This uses generator functions to generate permutations on demand.

The typescript is the original, the js version is just the compiled typescript.

@echo off
IF "%1" == "" (
echo %cd% >> %userprofile%\_k
) ELSE (
IF "%1" == "ls" (
type %userprofile%\_k
exit /B
)
@Alligator
Alligator / gist:3960707
Created October 26, 2012 18:56
jsweekly bingo
JSWEEKLY BINGO
+-------------------------------+-------------------------------+-------------------------------+
| An atricle from someone who | | |
| just figured out | Baby's first functional | How to do this one very |
| prototype-based OO and thinks | programming | specific thing in Node.js |
| everyone else needs telling | | |
+-------------------------------+-------------------------------+-------------------------------+
| | | |
| A new jQuery release | A job in San Francisco | An introduction to an MVC |
| | | framework |
class Wren {
construct new() {
var a = 0
_list = [1,2,3].map{|i|
a = a + 1
return a
}
}
printList() {
class Wren {
construct new() {
var a = 0
_list = [1,2,3].map{|i|
a = a + 1
return a
}
}
printList() {
import json
import urllib2
import time
import sys
import lxml.html
from datetime import datetime, timedelta
# get viewers
j = json.load(urllib2.urlopen('https://api.twitch.tv/kraken/streams/speeddemosarchivesda'))
import socket
sock = socket.socket(socket.AF_INET, socket.TCP_NODELAY)
sock.connect(('irc.synirc.net', 6667))
sock.setblocking(0)
def irc_connect():
buff = ''
while 1:
try:
import math
import random
import functools
import sys
# an inefficient ga for the travelling salesman problem
# stuff to think about:
# chromosomes can't be repeated, so crossover and mutation have to be changed
# mutation: swap two elements
# crossover: use ordered crossover
@Alligator
Alligator / really.cs
Created May 27, 2012 11:13 — forked from anonymous/really.cs
really?
if(i==1)
return 4;
if(i==2)
return 4;
if(i==3)
return 4;
if(i==4)
return 4;
if(i==5)
return 4;
import ctypes, ctypes.wintypes
xinputDLL = ctypes.windll.xinput9_1_0
class XINPUT_VIBRATE(ctypes.Structure):
_fields_ = [
('left_motor', ctypes.wintypes.WORD),
('right_motor', ctypes.wintypes.WORD),
]