Skip to content

Instantly share code, notes, and snippets.

@jagill
jagill / longlinebug.js
Created September 10, 2014 17:38
Example of syntax highlighting bug for long lines in atom's javascript package
var languageTags6391To6392 = {'ab':'abk','aa':'aar','af':'afr','sq':'sqi','am':'amh','ar':'ara','an':'arg','hy':'hye','as':'asm','ae':'ave','ay':'aym','az':'aze','ba':'bak','eu':'eus','be':'bel','bn':'ben','bh':'bih','bi':'bis','bs':'bos','br':'bre','bg':'bul','my':'mya','ca':'cat','ch':'cha','ce':'che','zh':'zho','cu':'chu','cv':'chv','kw':'cor','co':'cos','hr':'hrv','cs':'ces','da':'dan','dv':'div','nl':'nld','dz':'dzo','en':'eng','eo':'epo','et':'est','fo':'fao','fj':'fij','fi':'fin','fr':'fra','gd':'gla','gl':'glg','ka':'kat','de':'deu','el':'ell','gn':'grn','gu':'guj','ht':'hat','ha':'hau','he':'heb','hz':'her','hi':'hin','ho':'hmo','hu':'hun','is':'isl','io':'ido','id':'ind','ia':'ina','ie':'ile','iu':'iku','ik':'ipk','ga':'gle','it':'ita','ja':'jpn','jv':'jav','kl':'kal','kn':'kan','ks':'kas','kk':'kaz','km':'khm','ki':'kik','rw':'kin','ky':'kir','kv':'kom','ko':'kor','kj':'kua','ku':'kur','lo':'lao','la':'lat','lv':'lav','li':'lim','ln':'lin','lt':'lit','lb':'ltz','mk':'mkd','mg':'mlg','ms':'m
@jagill
jagill / gist:8ff45414c9ad640a409a
Last active August 29, 2015 14:07
Listener tech spec
/*
* A Listener has four states: stopped, listening, continuous (listening), and stopping.
* (we'll handling pending/not-supported later).
* It starts off as stopped. It can be started normally, or in continuous mode.
*
* Listener Methods
* ================
*
* Listener.start (normal):
* listener.continous = false
@jagill
jagill / editor-0df1847531833806dd71e863147724f10f937e15
Created December 9, 2014 04:31
Storage file for bug in atom
{"mode":"editor","version":1,"windowDimensions":{"x":1975,"y":-439,"width":1998,"height":1112,"maximized":false},"grammars":{"deserializer":"GrammarRegistry","grammarOverridesByPath":{}},"project":{"paths":["/Users/jag/euler"],"buffers":[{"text":"# coding: utf8\n\n'''\nTriangle, pentagonal, and hexagonal numbers are generated by the following\nformulae:\n\nTriangle\t \tTn=n(n+1)/2\t \t1, 3, 6, 10, 15, ...\nPentagonal\t \tPn=n(3n−1)/2\t \t1, 5, 12, 22, 35, ...\nHexagonal\t \tHn=n(2n−1)\t \t1, 6, 15, 28, 45, ...\nIt can be verified that T285 = P165 = H143 = 40755.\n\nFind the next triangle number that is also pentagonal and hexagonal.\n'''\n\ndef triangle(n):\n return n*(n+1)/2\n\ndef pentagonal(n):\n return n*(3*n-1)/2\n\ndef hexagonal(n):\n return n*(2*n - 1)\n\n\ncurrentTn = 0\ncurrentT = 0\n\ncurrentPn = 0\ncurrentP = 0\n\ni = 0\nwhile True:\n i += 1\n h = hexagonal(i)\n while currentT < h:\n currentTn += 1\n currentT = triangle(currentTn)\n while currentP < h:\n cu
@jagill
jagill / indentMove.vim
Created August 4, 2012 11:40
Move to same/different indented line in vim
" This is James Gill's (https://github.com/jagill) version of
" http://vim.wikia.com/wiki/Move_to_next/previous_line_with_same_indentation
" I needed the option to move to a line with a different level of indentation,
" instead of just a lower level.
"
" Jump to the next or previous line that has the same level (or different
" level) of indentation than the current line.
"
" exclusive (bool): true: Motion is exclusive
" false: Motion is inclusive
@jagill
jagill / Safari_iOS_Versions.txt
Created September 4, 2012 04:16
Mobile Safari to iOS version translator
Safari_Release_Version Safari_User-Agent_Version iOS_Versions
6.0 8536.25 6.0
5.1 7534.48.3 5.0.x
5.0.2 6533.18.5 4.2.x-4.3.x
4.0.5 6531.22.7 4.0.x-4.1.0
4.0.4 531.21.10 3.2.x
4.0 528.16 3.0.x-3.1.x
Unknown 525.18.1 2.2.1
3.1.1 525.20 2.0.x-2.2.0
3.0 419.3 1.x
@jagill
jagill / UIDeviceHardware.h
Created September 4, 2012 04:21 — forked from Ricardo1980/UIDeviceHardware.h
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
+ (NSString *) platform;
+ (NSString *) platformString;
@jagill
jagill / gist:3762811
Created September 21, 2012 17:35
KVCSerializer Boolean error
KVCModel *model = [[KVCModel alloc] init];
model.aBoolean = NO;
NSDictionary *falseDict = [model objectToDictionary];
NSLog(@"falseDict has boolean: %@", [falseDict objectForKey:@"aBoolean"]);
//2012-09-21 10:30:49.370 otest[12887:303] falseDict has boolean: 0
model.aBoolean = YES;
NSDictionary *trueDict = [model objectToDictionary];
<head>
<title>dynamicSubscriptions</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
@jagill
jagill / joinTest.coffee
Created July 31, 2013 23:15
An example of a "join" with meteor. It's client-powered, which is fine as long as you don't mind people intentionally choosing to get a different set of items.
###
Add coffeescript, random packages:
$ meteor add coffeescript random
Remove autopublish package:
$ meteor remove autopublish
###
##Set up collections and subscriptions
Items = new Meteor.Collection 'items'
@jagill
jagill / laikaTest.js
Created October 28, 2013 15:53
laika fails on pending tests
assert = require('assert');
describe('Test test', function(){
it('should ignore pending tests');
//it('should ignore pending tests', function(){
//assert.ok(true);
//});