Skip to content

Instantly share code, notes, and snippets.

@Hirrolot
Hirrolot / tagless-final.rs
Last active April 27, 2024 04:30
Tagless-final encoding of a simple arithmetic language in Rust
trait Interp {
type Repr<T>;
fn lit(i: i32) -> Self::Repr<i32>;
fn add(a: Self::Repr<i32>, b: Self::Repr<i32>) -> Self::Repr<i32>;
}
struct Eval;
impl Interp for Eval {
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 27, 2024 04:29
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@ww9
ww9 / one-line-text-art-and-emojis_utf8_ascii.txt
Last active April 27, 2024 04:27
Emojis, UTF8, ASCII (one line) #misc
# Collection of one line text art (◕‿◕✿)
Collection of emojis and one line text art like (╯°□°)╯︵ ┻━┻ 🤗
ּבּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
{
"manifest_version": 2,
"name": "Chrome Socket API Server",
"description": "listen & accept for socket",
"version": "0.1",
"app": {
"background": {
"scripts": ["server.js"]
}
},
@0xjjpa
0xjjpa / mobile.html
Created February 3, 2014 15:08
Meta tag for designing on a 640px mobile screen, targeting the font to then match it unless it's an ipad.
<meta id="viewport" name="viewport" content="width=320, intial-scale=0.5, maximum-scale=.5, minimum-scale=.5, user-scalable=no"/>
<script>
(function(doc) {
if (navigator.userAgent.match(/iPad/i)) {
doc.getElementById("viewport").setAttribute("content", "initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no");
}
}(document));
</script>
@0xjjpa
0xjjpa / mediaqueries.scss
Created November 28, 2013 12:54
Media Query Sass Recipe
$break-small: 480px;
$break-large: 1024px;
@mixin media-query-for($device) {
@if $device == palm {
@media only screen and (max-width: $break-small) { @content; }
}
@else if $device == lap {
@media only screen and (min-width: $break-small + 1) and (max-width: $break-large - 1) { @content; }
}
@0xjjpa
0xjjpa / typography.css
Created February 2, 2014 17:13
Modern scale for typography
/* Read article at http://typecast.com/blog/a-more-modern-scale-for-web-typography */
body {
font-size: 100%;
}
body, caption, th, td, input, textarea, select, option, legend, fieldset, h1, h2, h3, h4, h5, h6 {
font-size-adjust: 0.5;
}
#page {
@androidfred
androidfred / advanced_anki_deck_editing.md
Last active April 27, 2024 04:25
Advanced Anki deck editing made simple (ish)

Advanced Anki deck editing made simple (ish)

Anki is a great open source flashcard app that can be used to learn anything.

This Gist is a full end to end example of how to:

  • export Anki decks from Anki
  • import Anki decks into MySQL
  • edit Anki decks using MySQL
  • export Anki decks from MySQL
window.mobilecheck = function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v