This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>MathJax example</title> | |
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> | |
<script id="MathJax-script" async | |
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"> | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'securerandom' | |
require 'base64' | |
require 'uri' | |
# This is probably provided by a library in your language. | |
def encrypt(data) | |
salt = "" | |
8.times { salt << rand(255).chr } | |
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc") | |
cipher.encrypt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From http://diotlabs.daraghbyrne.me/2-leds-continued/using-rgb-leds/ | |
int redPin = D0; // RED pin of the LED to PWM pin **A4** | |
int greenPin = D2; // GREEN pin of the LED to PWM pin **D0** | |
int bluePin = D3; // BLUE pin of the LED to PWM pin **D1** | |
int redValue = 255; // Full brightness for an Cathode RGB LED is 0, and off 255 | |
int greenValue = 255; // Full brightness for an Cathode RGB LED is 0, and off 255 | |
int blueValue = 255; // Full brightness for an Cathode RGB LED is 0, and off 255</td> | |
void setup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
func generateEquatable(_ t: Any) -> String { | |
var output = "" | |
let mirrorPlace = Mirror(reflecting: t) | |
let type = mirrorPlace.subjectType | |
output += ("extension \(type): Equatable {\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This handles most storyboard style injection needs | |
extension UIViewController { | |
func injectable<T>() -> T? { | |
var controller: UIViewController? = self | |
if let nav = self as? UINavigationController { | |
controller = nav.viewControllers.first | |
} | |
return controller as? T | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function execute_loop() { | |
var vmfunc, pathtab, path; | |
var pathstart, pathend; | |
if (resumefuncop) { | |
//qlog("### at resume time, storing value " + resumevalue + " at funcop " + resumefuncop.key); | |
store_operand_by_funcop(resumefuncop, resumevalue); | |
resumefuncop = null; | |
resumevalue = 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
protocol Matchable : Equatable, Comparable { } | |
class Matcher<T : Matchable> { | |
let subjectWrapper: T[] | |
var subject: T { | |
get { | |
return subjectWrapper[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define p1prime(p1,p2,p3,p4) (u0*u0*u0*p1 + (t0*u0*u0 + u0*t0*u0 + u0*u0*t0)*p2 + (t0*t0*u0 + u0*t0*t0 + t0*u0*t0)*p3 + t0*t0*t0*p4) | |
#define p2prime(p1,p2,p3,p4) (u0*u0*u1*p1 + (t0*u0*u1 + u0*t0*u1 + u0*u0*t1)*p2 + (t0*t0*u1 + u0*t0*t1 + t0*u0*t1)*p3 + t0*t0*t1*p4) | |
#define p3prime(p1,p2,p3,p4) (u0*u1*u1*p1 + (t0*u1*u1 + u0*t1*u1 + u0*u1*t1)*p2 + (t0*t1*u1 + u0*t1*t1 + t0*u1*t1)*p3 + t0*t1*t1*p4) | |
#define p4prime(p1,p2,p3,p4) (u1*u1*u1*p1 + (t1*u1*u1 + u1*t1*u1 + u1*u1*t1)*p2 + (t1*t1*u1 + u1*t1*t1 + t1*u1*t1)*p3 + t1*t1*t1*p4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NSString < Mobi::Cocoa::Object | |
end | |
class UIAlertView < Mobi::Cocoa::Object | |
def self.alert(title, message, options={}) | |
alert = UIAlertView._alloc \ | |
._initWithTitle _S(title), | |
:message, _S(message), | |
:delegate, nil, | |
:cancelButtonTitle, options[:cancel_title] ? _S(options[:cancel_title]) || nil, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Foo | |
def bar | |
@bar ||= self.snakes | |
end | |
end | |
class Baz | |
def self.snakes | |
[:cobra] |
NewerOlder