Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am alxhill on github.
  • I am alxhill (https://keybase.io/alxhill) on keybase.
  • I have a public key whose fingerprint is F1BB BC80 7F07 047B AE66 DF60 C1AA 4048 3484 3866

To claim this, I am signing this object:

@alxhill
alxhill / generated.cpp
Created February 14, 2016 13:02
C++-like code generated using a Recurrent Neural Network trained on the WebKit source code
JSValue, SVGNames::onedNamespaceValuesDirection());
inline MachineThroughPosition::setAppendSubstituteChildren() const
{
return AccessibilityObject::handleDecoder;
}
inline RefPtr<RefPtr<ExpressionNode> createInstance();
HashMap<ShaderType>& misspectedLocalNames()
@alxhill
alxhill / scrollspy.coffee
Created October 8, 2013 15:44
Updated version of Angular ScrollSpy
angular.module('jobFoundryDirectives').directive 'spy', ($location) ->
restrict: "A"
require: "^scrollSpy"
link: (scope, elem, attrs, scrollSpy) ->
attrs.spyClass ?= "current"
elem.click ->
scope.$apply ->
$location.hash(attrs.spy)
@alxhill
alxhill / fact.ll
Created May 20, 2013 22:55
Factorial in LLVM bytecode
; the string used in printf
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
define i64 @fact(i64 %n) nounwind readnone ssp uwtable {
entry:
; go to retn if n is 1, else branch to retfactn
%0 = icmp eq i64 %n, 1
br i1 %0, label %retn, label %retfactn
retn:
@alxhill
alxhill / Cakefile
Created November 26, 2012 15:38
Cakefile that creates a self rebooting server on file change
fs = require 'fs'
{print} = require 'sys'
{spawn, fork} = require 'child_process'
processes = {}
process.on "exit", ->
for k, p of processes
@alxhill
alxhill / statify.py
Created September 7, 2011 17:37
Statify - turn a dynamic page static
#!/usr/bin/python
import sys
import urllib
import os
def statify(baseurl, pages, folder, home=True):
os.mkdir(folder)
@alxhill
alxhill / Usage Example.md
Created February 24, 2011 22:22
A simple view controller for CodeIgniter/my gallery system.

First load the library $this->load->library('view');

Then add messages, data, templates etc $this->view->template('admin')->title('Admin control panel')->message->('success','You have successfully logged in')->data($data);

Finally, load the view. Done! $this->view->load();

@alxhill
alxhill / primes.rb
Created January 19, 2011 21:42
From @jamierumbelow - a simple Ruby script to get x number of primes.
# Prime number finder
# Usage: 20.primes, 100.primes
module GetAllPrimeNumbers
def primes
# Get all numbers from 0 to the current number as an array
nums = (0 .. self).to_a
# We know 0 and 1 can't be prime
nums[0] = nums[1] = nil