Skip to content

Instantly share code, notes, and snippets.

View trafnar's full-sized avatar

Nathan Manousos trafnar

View GitHub Profile
@trafnar
trafnar / gist:367966
Created April 16, 2010 03:21
Examples of common CSS properties and techniques
<style type="text/css" media="screen">
*{margin:0; padding:0;}
h1,h2{margin-bottom:10px; margin-top:30px;}
body{padding:30px;}
</style>
<h1>floats</h1>
<h2>simple left/right</h2>
<style type="text/css" media="screen">
#simple_floats{overflow:auto; border:5px solid #092994; width:500px;}
@jimeh
jimeh / jquery.myplugin.coffee
Created April 7, 2011 23:44
Example jQuery plugin written in CoffeeScript, and the resulting compiled JavaScript file.
$.fn.extend
myplugin: (options) ->
self = $.fn.myplugin
opts = $.extend {}, self.default_options, options
$(this).each (i, el) ->
self.init el, opts
self.log el if opts.log
$.extend $.fn.myplugin,
default_options:
@ukstudio
ukstudio / hello.coffee
Created April 18, 2011 17:28
CoffeeScript+QUnit
hello = -> 'hello'
# Helper function that returns a number with its correct indefinite article
# e.g. number_with_indefinite_article(10) #=> "a 10"
# e.g. number_with_indefinite_article(80, "$") #=> "an $80"
def number_with_indefinite_article(number, prefix=nil)
[indefinite_article_for_number(number), " ", prefix, number].compact.join
end
# Helper function that returns the correct indefinite article for a number
# e.g. indefinite_article_for_number(10) #=> "a"
# e.g. indefinite_article_for_number(80) #=> "an"
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@Avaq
Avaq / combinators.js
Last active July 15, 2024 14:46
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@jamieweavis
jamieweavis / macos-app-icon.md
Last active June 30, 2024 08:23
How to create an .icns macOS app icon
@exogen
exogen / graphql-server.js
Last active October 26, 2017 18:06
Simple GraphQL server
const express = require('express')
const graphqlHTTP = require('express-graphql')
const makeExecutableSchema = require('graphql-tools').makeExecutableSchema
const schema = makeExecutableSchema({
typeDefs: `
type Query {
user: User
}
@doctorpangloss
doctorpangloss / repetition_algorithm.ipynb
Last active November 23, 2023 19:13
Supermemo 2 Algorithm, Unobscured (Python 3)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@francisrstokes
francisrstokes / GeneratorDSL.js
Last active November 3, 2021 16:39
Game-style DSL using generators
const getDSLValue = (iterator, last) => {
const {value, done} = iterator.next(last);
if (done) {
return value;
}
switch (value) {
case 'sword': {
return getDSLValue(iterator, {
weaponType: "Shiny Sword",