This file contains 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 { LitElement } from 'https://cdn.pika.dev/lit-element@^2.3.1'; | |
/** @typedef {new (...args: any[]) => any} Constructor */ | |
/** | |
* @template {!Constructor} T | |
* @param {T} superclass - The class to extend | |
*/ | |
const FormControlMixin = (superclass) => | |
class FormControl extends superclass { |
This file contains 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
-- AppleScript to copy a Safenet MobilePASS OTP. | |
-- | |
-- 'osascript ~/path/to/token.applescript' | |
-- Set 'passwd' to your MobilePASS passcode. | |
set passwd to "0000" | |
-- Start MobilePASS | |
tell application "MobilePASS" | |
activate | |
delay 1 |
This file contains 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
-- Apple Script to connect VPN Client with Password and Safenet MobilePass OTP. | |
set vpn_name to "'VPN Connection 01'" | |
set user_name to "username" | |
set passwd to "Password" | |
tell application "MobilePASS" | |
activate | |
end tell | |
tell application "System Events" |
This file contains 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
/* https://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/ | |
Namespaces can still be documented when a more abstract mechanism is used. @lends allows members to be added to an existing namespace: | |
*/ | |
/** | |
* Root namespace | |
* @namespace root | |
*/ | |
$namespace('root', /** @lends root **/ { | |
/** |
This file contains 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
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything | |
require 'rouge' | |
require 'method_source' | |
require 'pp' | |
class Dbg | |
def initialize(object, to:) | |
@object, @stream = object, to | |
end |
This file contains 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
// exporter1.js | |
let foo = 1; | |
export { foo as default }; // exports the foo binding | |
foo = 2; | |
// exporter2.js | |
let foo = 1; | |
export default foo; // creates a new binding named *default* and initializes it to 1. | |
foo = 2; // assigns to the foo binding which is not exported |
This file contains 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
var React = require('react/addons'), | |
TestUtils = React.addons.TestUtils, | |
TestContext = require('./TestContext'), | |
App = require('./App.jsx'), | |
app = TestContext.getRouterComponent(App); | |
describe('App', function() { | |
it('has something', function() { | |
expect(app.getDOMNode().textContent).toContain('something'); | |
}); |
This file contains 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 Regexp | |
def to_proc | |
proc {|str| match(str) && $~.to_s } | |
end | |
end | |
arr = [ "foo", "bar 123", "baz", "456", "789 qux" ] | |
p arr.find(&/bar/) # => "bar 123" |
This file contains 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 API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
This file contains 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
#!/usr/bin/env ruby | |
require "webrick" | |
server = WEBrick::HTTPServer.new(Port: 8080, DocumentRoot: Dir::pwd) | |
trap("INT") { server.shutdown } | |
server.start |
NewerOlder