Skip to content

Instantly share code, notes, and snippets.

View jbenner-radham's full-sized avatar

James Benner jbenner-radham

View GitHub Profile
@song2010
song2010 / PY0101EN-2-3-Dictionaries.ipynb
Created January 10, 2020 21:44
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# list enabled
# pm list packages -e
# list disabled
# pm list packages -d
# disable
# pm disable-user --user 0 <package>
# enable
; nasm -felf64 a.asm && ld -o a.out a.o
; then
; gdb a.out
section .data
; initialize some data
someValue dq 8
initialTable dq 40, 871, 181, 157, 268, 790, 310, 211
fileName db "zaliczenie.txt"
@skaur7
skaur7 / PY0101EN-2-1-Tuples.ipynb
Created January 10, 2020 21:37
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpitt
cpitt / memoizeLocalStorage.js
Last active May 3, 2024 03:58
Memoize a function using local storage as it's cache
/**
* memoizes a function using localStorage as the cache
* @param {function|Promise} fn function or promise you wish to memoize
* @param {Object} [options] additional configuration
* @param {number} [options.ttl=0] time to live in seconds
* @param {Boolean} [options.backgroundRefresh=false] whether the cache should be refreshed asynchronously,
* Note: new results won't resolve until next execution
* @return {Promise} Promise object represents memoized result
*/
function memoizeLocalStorage(
{
const compose = (...fns) => (val) => fns.reduceRight((x, fn) => fn(x), val);
const sum = (result, item) => result + item;
const mult = (a, b) => a * b;
function wrap(xf){
return {
// 1. We require init as arg, so do not need here
init: function(){
throw new Error('init not supported');
@zjplab
zjplab / comparator_map.cpp
Created January 10, 2020 21:35
C++ Comparator(Custom comparison ops)
struct cmpByStringLength {
bool operator()(const std::string& a, const std::string& b) const {
return a.length() < b.length();
}
};
// ...
std::map<std::string, std::string, cmpByStringLength> myMap;
pub fn on_pointer(&mut self, state: &mut ApplicationState, position: Point2<f32>) {
let projection_matrix = create_projection_matrix(self.last_size);
let projection_inverse = projection_matrix.try_inverse().unwrap();
// Transform the window position to a 3D ray from the camera
let ray_clip = Vector3::new(
(2.0 * position.x) / self.last_size.x as f32 - 1.0,
(2.0 * position.y) / self.last_size.y as f32 - 1.0,
// Remember, inverse Z
@broskees
broskees / nocache.php
Last active January 10, 2020 22:35
A quick catch-all cache-busting WordPress plugin when having clients clear their browser cache isn't an option.
<?
/**
* Plugin Name: WordPress Catch All Cache Buster
* Description: A quick catch-all cache-busting WordPress plugin when having clients clear their browser cache isn't an option.
* Version: 1.0.0
* Author: Joseph Roberts
* Author URI: https://github.com/DigitalJoeCo
* License: MIT
* License URI: http://opensource.org/licenses/MIT
*/
@gautam678
gautam678 / .hyper.js
Last active January 10, 2020 22:35
My Hyper configuration for MacOS Catalina
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Upload Hyper to github sync settings
syncSettings: {
quiet: false,
accelerators: {