Skip to content

Instantly share code, notes, and snippets.

@mankyKitty
mankyKitty / gist:10569173
Last active August 29, 2015 13:59
Trying to grok Functor for (a -> m b) type....thingy
-- Working through the Yorgey lectures on Applicatives for Haskell and trying to work out the homework...
-- A parser for a value of type a is a function which takes a String
-- represnting the input to be parsed, and succeeds or fails; if it
-- succeeds, it returns the parsed value along with the remainder of
-- the input.
newtype Parser a = Parser { runParser :: String -> Maybe (a, String) }
-- For example, 'satisfy' takes a predicate on Char, and constructs a
-- parser which succeeds only if it sees a Char that satisfies the
@igrigorik
igrigorik / TweetEvent.java
Created May 27, 2011 06:19
wrapping esper with JRuby embrace
// A simple Tweet POJO:
// $> javac TweetEvent.java
public class TweetEvent {
private String user;
private String text;
private String timezone;
private int retweets;
public TweetEvent(String user, String text, String timezone, int retweets) {
@jbrechtel
jbrechtel / project.scala
Created May 6, 2012 17:32
Scala Android project with Proguard and ActionBarSherlock
import scala.xml.{Node => XmlNode}
import scala.xml._
import java.io.FileWriter
import sbt._
import Keys._
import AndroidKeys._
@sineld
sineld / laravel-upload-resize.php
Created September 25, 2012 08:11
Laravel File Upload And Resize
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// perform any custom startup stuff you need to ...
// process your launch options
NSArray *keyArray = [launchOptions allKeys];
if ([launchOptions objectForKey:[keyArray objectAtIndex:0]]!=nil)
{
// we store the string, so we can use it later, after the webView loads
NSURL *url = [launchOptions objectForKey:[keyArray objectAtIndex:0]];
self.invokeString = [url absoluteString];
@ifaour
ifaour / MyCustomActivity.java
Last active September 16, 2016 03:31
Example custom parse push receiver
package com.parse.starter;
import android.app.Activity;
import android.os.Bundle;
import com.parse.ParseAnalytics;
public class MyCustomActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@kukat
kukat / custom.css
Last active November 14, 2016 13:49
nvAlt with code highlight template.html
/*
This is my hacked up copy of Marked.app/Contents/Resources/gridless.css
Changes:
1. Smaller headings
2. ~~No scrollbars~~ (I now prefer the Lion default behavior)
3. Styling of definition lists ala LaTeX description lists.
4. Centering h1.title, h3.author, h4.date (pandoc's title/author/date block).

Installation

FreeBSD

portmaster irc/irssi
portmaster irc/irssi-xmpp

OS X

brew install irssi

/**
* HighlightableImage.js
*
* If we simply change the source prop of an Image in the render method, the
* image blinks, and there is no image for a fraction of a second. This is
* solved by mounting 2 images and changing their opacity.
*
*/
import React from 'react'
import {