Skip to content

Instantly share code, notes, and snippets.

View augbog's full-sized avatar
🤡
heehee

Augustus Yuan augbog

🤡
heehee
View GitHub Profile
@cgmartin
cgmartin / gist:10328349
Last active August 29, 2015 13:58
grunt-newer: Check for newer @import .less files
//
// grunt-newer:
// Check for newer @import .less files example
// See: https://github.com/tschaub/grunt-newer/issues/29
//
grunt.initConfig({
// ...
newer: {
options: {
override: function(taskName, targetName, filePath, time, include) {
const arrayIterator = (array) => {
let i = 0;
return () => {
const done = i < array.length;
return {
done,
value: done ? undefined : array[i++]
}
@jamescobalt
jamescobalt / private.xml
Created May 19, 2015 04:40
Karabiner Keyboard Remapping File for the E-Element RGB keyboard under Mac OS X
<?xml version="1.0"?>
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APP_Calculator</name>
<url type="file">/Applications/Calculator.app</url>
</vkopenurldef>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APP_Mail</name>
@migreva
migreva / gist:2a926b95f25366da657c
Last active January 15, 2016 03:44 — forked from cgmartin/gist:10328349
Less + newer: Watch for imported file changes
//
// grunt-newer:
// Check for newer @import .less files example
// See: https://github.com/tschaub/grunt-newer/issues/29
//
grunt.initConfig({
// ...
newer: {
options: {
override: function(details, include) {
@xav76
xav76 / index.html
Created October 24, 2012 17:12
A CodePen by Hakim El Hattab. Magnetic - An old <canvas> particle experiment of mine.
<p>Double-click to add new nodes. Drag to move them. <br>Change skin: <a id="prevSkin" href="#">Previous</a> / <a id="nextSkin" href="#">Next</a>.</p>
<canvas id='world'></canvas>
@ryanburgess
ryanburgess / .vimrc
Created September 13, 2016 15:29
.vimrc
"--------------------
" vundle
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
@adaline
adaline / twitter_update_with_media.coffee
Last active March 10, 2017 21:40
Node.js module for basic Twitter update_with_media support. You will need to install 'request' packages from npm like so: npm install request
fs = require('fs')
path = require('path')
request = require('request')
class twitter_update_with_media
constructor: (@auth_settings) ->
@api_url = 'https://api.twitter.com/1.1/statuses/update_with_media.json'
post: (status, file_path, callback) ->
r = request.post(@api_url, oauth:@auth_settings, callback)
@elijahmanor
elijahmanor / fake-server-unit-test.js
Last active August 28, 2018 09:23
Unit Test like a Secret Agent with Sinon.js
describe("getTweets - Server", function () {
var server, fakeData = [ /* ... */ ];
before(function () {
// Doesn’t work :( It’s JSONP!
server = sinon.fakeServer.create();
server.respondWith(
"GET",
"https://api.twitter.com/.../elijahmanor.json?count=5",
[200, { "Content-Type": "application/json" }, JSON.stringify(fakeData)]
@jsomers
jsomers / websockets.md
Created September 27, 2018 12:50
Using websockets to easily build GUIs for Python programs

Using websockets to easily build GUIs for Python programs

I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).

You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:

high-priority

(Each row represents a "worker" in my model, and each rectangle represents a "task.")

@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();