Skip to content

Instantly share code, notes, and snippets.

@steinn
steinn / slack_random.sh
Last active December 16, 2020 17:51
Post random number from random.org to a channel on Slack
#!/bin/bash
RANDOM_URL=http://www.random.org/integers/?num=1\&min=1\&max=100\&col=1\&base=10\&format=plain\&rnd=new
RND_NUMBER=$(curl $RANDOM_URL)
MESSAGE=$RND_NUMBER
USERNAME="random.org"
CHANNEL="#random"
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"$USERNAME\", \"text\": \"$MESSAGE\"}"
@samuelhorn
samuelhorn / preferences.sublime-settings
Last active December 24, 2015 13:58
Sublime Text 2 - User settings
{
// Make folders in sidebar bold
"bold_folder_labels": false,
// Nicer caret animation
"caret_style": "phase",
// Set colorscheme
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
@runemadsen
runemadsen / plugin.rb
Created August 18, 2013 20:56
Generating pagination pages for multiple categories in Jekyll
module Jekyll
class Pagination < Generator
def generate(site)
end
end
class CategoryPages < Generator
safe true
@clouddueling
clouddueling / MainCtrl.js
Last active November 3, 2022 13:26
How to authenticate using AngularJS
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
@fastdivision
fastdivision / author.html
Last active September 3, 2020 20:09
Jekyll Examples
<div class="byline author vcard">
<a class="photo" href="{% render_author url %}">
<img src="{% render_author avatar %}" alt="{{ page.author }}" title="{{ page.author }}">
</a>
<h2>{{ page.author }}</h2>
<div class="author-bio">
<p>{% render_author bio %}</p>
</div>
</div>
@alex-seville
alex-seville / gist:5861160
Created June 25, 2013 18:45
Blanket with browser mocha+requirejs
<!DOCTYPE html>
<html>
<head>
<title>BaseViewModel.js specs</title>
<link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
@creationix
creationix / output.log
Created May 8, 2013 22:02
Working version of generator async code sample. Using node from https://github.com/andywingo/node/tree/v8-3.19
tim@touchsmart:~/Code$ nvm use v0.11.2-generators
Now using node v0.11.2-generators
tim@touchsmart:~/Code$ node --harmony testgen.js
<Buffer 76 61 72 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 3b 0a 66 75 6e 63 74 69 6f 6e 20 72 65 61 64 46 69 6c 65 28 70 61 74 68 2c 20 65 6e 63 ...>
Sleeping for 2000ms...
Done
@magnetikonline
magnetikonline / README.md
Last active February 7, 2025 07:27
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.