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 Tree | |
| attr_accessor :children, :node_name, :depth | |
| def initialize(structure, depth) | |
| @node_name = structure.keys.first | |
| @depth = depth | |
| @children = structure.values.first.map { |name,child| Tree.new({name,child}, depth+1) } | |
| end |
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
| puts | |
| print "File name: " | |
| filename = gets.chomp | |
| puts | |
| print "Search term: " | |
| phrase = gets.chomp | |
| File.open(filename, "r") do |file| |
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
| puts "\nHello. What's your name?" | |
| print "[Your name]: " | |
| name = gets.chomp | |
| puts | |
| puts "Hello #{name}." | |
| theMagicNumber = rand(100)+1 |
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 ActsAsCsv | |
| include Enumerable | |
| def self.included(base) | |
| base.extend ClassMethods | |
| end | |
| module ClassMethods | |
| def acts_as_csv |
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
| fibonacci_loopy := method(n, | |
| fib_list := List clone | |
| for(i, 0, n-1, | |
| if (i == 0 or i == 1, | |
| fib_list append(1), | |
| fib_list append(fib_list at(i-2) + fib_list at(i-1)) | |
| ) | |
| ) | |
| fib_list at(fib_list size-1) |
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
| # antivirus | |
| cinst autohotkey # avg installer uses autohotkey... | |
| cinst avgantivirusfree | |
| # windows updates + reboot | |
| Install-WindowsUpdate -acceptEula | |
| if (Test-PendingReboot) { Invoke-Reboot } | |
| # iis | |
| cinst IIS-WebServerRole -source windowsfeatures |
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
| ;; put this file in ~/.emacs.d/private/org-brain | |
| ;; then add org-brain into your dotspacemacs-configuration-layers in .spacemacs | |
| (defconst org-brain-packages | |
| '(org-brain) | |
| ) | |
| ;; see https://github.com/Kungsgeten/org-brain#setup-and-requirements | |
| (defun org-brain/init-org-brain () | |
| (use-package org-brain |
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
| <p style="margin-bottom: 0px; font-size: 18px; line-height: normal; font-family: Helvetica; color: rgb(6, 2, 1); -webkit-text-stroke-width: initial; -webkit-text-stroke-color: rgb(6, 2, 1);"><span style="font-kerning: none"><b>Aylesbury Restart Party & Makers' Fair</b></span></p> | |
| <p style="margin-bottom: 0px; line-height: normal; font-family: 'Lucida Grande'; color: rgb(6, 2, 1); -webkit-text-stroke-width: initial; -webkit-text-stroke-color: rgb(6, 2, 1);"><span style="font-kerning: none"><b>Jul 22, 2017</b></span></p> | |
| <p style="margin-bottom: 0px; line-height: normal; font-family: 'Lucida Grande'; color: rgb(6, 2, 1); -webkit-text-stroke-width: initial; -webkit-text-stroke-color: rgb(6, 2, 1); background-color: rgb(157, 215, 226); min-height: 17px;"><span style="font-kerning: none"><b></b></span><br></p> | |
| <p style="margin-bottom: 0px; line-height: normal; font-family: 'Lucida Grande'; color: rgb(6, 2, 1); -webkit-text-stroke-width: initial; -webkit-text-stroke-color: rgb(6, 2, 1);"><span style="font-kerni |
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 add_mastodon_syndication_target($synd_urls, $user_id) | |
| { | |
| $masto_target['uid'] = "social_coop"; | |
| $masto_target['name'] = "social.coop"; | |
| $synd_urls[] = $masto_target; | |
| return $synd_urls; | |
| } | |
| add_filter("micropub_syndicate-to", "add_mastodon_syndication_target", 10, 2); |
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
| wp_embed_register_handler( 'invidious_watch', '#https?://invidio\.us/watch\?v=([A-Za-z0-9\-_]+)#i', 'wp_embed_handler_invidious' ); | |
| wp_embed_register_handler( 'invidious_embed', '#https?://invidio\.us/embed/([A-Za-z0-9\-_]+)#i', 'wp_embed_handler_invidious' ); | |
| function wp_embed_handler_invidious( $matches, $attr, $url, $rawattr ) { | |
| $embed = sprintf( | |
| '<iframe src="https://invidio.us/embed/%1$s" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" width="600" height="400"></iframe>', | |
| esc_attr($matches[1]) | |
| ); | |
| return $embed; | |
| } |
OlderNewer