Skip to content

Instantly share code, notes, and snippets.

@tfogo
tfogo / matlabfix.sh
Created April 5, 2014 14:54
How to fix gray screen on MATLAB using Xmonad.
wmname LG3D
@tfogo
tfogo / JSTalk.md
Created March 2, 2014 12:59
Notes for a talk on client-side javascript I did for HackSoc Notts

JS Talk for HackSoc

1995 LiveScript released for NetScape Navigator. It was a language designed to by easy for non-programmers and to add cool dynamic functionality to websites. It ran in the web browser. These days all web browsers have JavaScript engines built in because it is the de facto scripting language of the web. Its name was quickly changed to JavaScript as a marketing ploy because Java was a very hot language at the time. But it has nothing to do with Java. The only thing it has in common is syntax because both languages have syntax based on C.

1996 JavaScript standardized by ECMA. The standard is called ECMAScript

JavaScript used to be famous for being really slow, but because of how important it is to dynamic web pages, companies like Google and Mozilla have sunk a tonne of money into making it faster. These days it's pretty fast and isn't only used in web browsers (see Node.js).

Language Basics for Beginners

@tfogo
tfogo / dummydata.js
Last active May 26, 2016 09:14
RESTful API with node.js and mongodb. `npm install` then `node server.js`
var mongoose = require('mongoose')
, Podcast = mongoose.model('Podcast');
Podcast.find({}).remove(function() {
Podcast.create({
title: 'Joe Rogan',
score: 4783,
tags: ['tag1', 'tag2', 'tag3'],
dateSubmitted: new Date
}, {
@tfogo
tfogo / ex1.c
Last active January 3, 2016 01:39
Example 1
void foo(int a) { // 1 is copied to another space in memory when foo() is called
// do something
}
int main() {
int a = 1; // 1 is now in memory
foo(a);
}
@tfogo
tfogo / cornify.js
Last active December 31, 2015 09:39
Sparklify your web pages!
jQuery.getScript('http://www.cornify.com/js/cornify.js',function(){ for (var i = 0; i < 25; i++) cornify_add() });
shh such algorithm
so commander as cat
plz cat.option with '-n, --number <n>' 'many number' parseInt
plz cat.parse with process.argv
such doge much nice
rly nice<1
@tfogo
tfogo / mongoose_example.js
Created October 26, 2013 12:36
MongoDB example with Mongoose
var express = require('express'),
app = module.exports = express.createServer(),
routes = require('./routes'),
mongoose = require('mongoose');
//MongoStore = require('connect-mongo')(express);
mongoose.connect('mongodb://localhost/randomstuffwhey');
var app = module.exports = express.createServer();
// This is why everyone needs jQuery in their lives...
$('img').each(function(){$(this).attr('src','http://www.placekitten.com/'+(Math.floor(Math.random()*100)+150)+'/'+(Math.floor(Math.random()*100)+150))});
@tfogo
tfogo / 0_reuse_code.js
Created October 17, 2013 21:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tfogo
tfogo / hacksocres.md
Last active December 25, 2015 19:59
HackSoc Notts resources, tailored for beginners.

Resources

About hackathons

Hackathons (or hack days) are super awesome events where people meet to build cool things. They're usually 24 hours straight programming/tinkering/building. Everybody gets involved, helps make something, then shows it to everybody else. Don't worry if you haven't been to one before, come along and you'll learn tons and have some great fun. Hackathons are pretty lighthearted and everyone's very helpful. Check out some past hackathons HackSoc have been to here: http://hacksocnotts.co.uk/category/news/

Preparing for a hackathon