Skip to content

Instantly share code, notes, and snippets.

View omgmog's full-sized avatar
⌨️

Max Glenister omgmog

⌨️
View GitHub Profile
@4foot30
4foot30 / diagonal.less
Last active August 29, 2015 14:27
Diagonal borders on any edge of an element, using SVG
// Give a block a slanted border
// Adapted from @omgmog's https://blog.omgmog.net/post/some-approaches-for-creating-diagonal-section-separators-for-your-website/
// Default to 30px high right-aligned white triangle on top edge
// See the comments after this mixin for diagrams of the positioning options
.diagonal-border(@opposite: 30px, @edge: 'top', @alignment: 'right', @colour: '#fff', @inset: false, @element: before) {
// Set relative positioning so you can use absolute positioning on the triangle
position: relative;
// Set polygon points for the triangles - outside the block
.setPoints() when (@edge = 'top') and (@alignment = 'left') and (@inset = false) {
@points: '0,0, 1,1, 0,1';

Think small

Try and aim for things that you can build in a couple of evenings or an afternoon. It’s more important to get things out, than working on things that seem bigger.

Once you’ve hacked a few things together:

  1. You’ll get ideas for bigger things
  2. You’ll have the mini-project code that you can put into the next thing.

Have a place to output

@chrismdp
chrismdp / rss_git_info.rb
Last active November 9, 2015 14:57
Use this little script to serve an Atom feed about your git repo. I use it to show a rolling ticker on my Twitch.TV live dev streaming channel. See it in action here: http://twitch.tv/chrismdp_
#!/usr/bin/env ruby
require 'builder'
require 'sinatra'
require 'action_view'
include ActionView::Helpers::DateHelper
get '/' do
date = Time.parse(`git show -s --format=%ci`.chomp)
(function(root) {
Object.assign(document.body.style, {
'transform': 'perspective(500px) rotateY(12deg) rotateX(9deg) rotateZ(-4deg) translate3d(56%, 26%, -516px)',
'transform-origin': '0 0',
'transform-style': 'preserve-3d'
})
const node_style = {
'outline': '3px solid rgba(255,0,150,0.5)',
'transform-style': 'preserve-3d',
@johnwards
johnwards / lastValue.js
Created May 15, 2012 11:39
get the value of last row in a sheet in google docs
function lastValue(column) {
var parts = column.split("!");
if (parts.length == 2) {
var sheetName = parts[0];
var column = parts[1];
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
} else {
var column = parts[0];
var sheet = SpreadsheetApp.getActiveSheet();
}
@franzenzenhofer
franzenzenhofer / jquery.bodysnatch.js
Created November 10, 2012 16:26
jquery plugin that replaces elements with absolute positioned clones of themselves, while hiding & silencing the originals
(function($){
isString = function (obj) {
return toString.call(obj) == '[object String]';
};
$.fn.bodysnatch = function() {
var collection = this;
return collection.each(function(a,b) {
var element = $(this);
var clone = element.clone();
@semenko
semenko / dmidecode
Last active October 26, 2021 02:57
Dell XPS 13 2015 model 9343 on Ubuntu 15.04, dmidecode, lsusb, lspci
$ sudo dmidecode
# dmidecode 2.12
# SMBIOS entry point at 0x000f0000
SMBIOS 2.8 present.
<SNIP>
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information

Following is a translation of a post by Kenta Cho (@abagames) about what he learned making 50 minigames in 2014. The original post is here:

http://d.hatena.ne.jp/ABA/20141223#p1

This translation is by Paul McCann (@polm23); please feel free to contact me with any comments or corrections.

The Secret to Creating Fun Games I Learned By Making 50 Games in a Year

... is that there isn't one.

@tim-reynolds
tim-reynolds / jquery.centerit.js
Created June 29, 2012 18:16
Setting scroll to center on an element (jQuery) - Super simple stuff
/*
If you have a horizontal (or vertical) scroll container and want to set the scroll to center a specific
element in the container you can use the following super simple technique.
I'm going to show you how it was derived, because it's important to know why, not just how.
*/
/*
Setup:
[HTML]
<div class="outer">
@dansanderson
dansanderson / p8_devterm_printwatcher.py
Last active June 11, 2022 23:38
Prints .lua.png files exported from PICO-8 on a DevTerm
# The PICO-8 text printer for the ClockworkPi DevTerm!
#
# This Python script allows you to print text directly from the PICO-8 source
# code editor. The script runs in the background and watches for you to execute
# the "EXPORT FILE.LUA.PNG" command. It does some light processing of the
# generated image file, then sends it to DevTerm's thermal printer.
#
# This is mostly just a joke/hack for the purposes of this tweet:
# https://twitter.com/dan_sanderson/status/1434253649266364417?s=20
#