Skip to content

Instantly share code, notes, and snippets.

@Zyber17
Zyber17 / typeClipboard.scpt
Created April 2, 2018 00:32
AppleScript to type the current clipboard
tell application "System Events"
keystroke (the clipboard)
end tell
@Zyber17
Zyber17 / fizzbuzz.js
Last active August 2, 2017 02:18
A Javascript fizzbuzz which is entirely functional and does not contain any of the following as substrings: for, while, if, else, return.
const fbGen = (fbValues, min, max) =>
Array.apply(null, Array(max - min + 1))
.map((val, i) => min + i)
.map(val =>
fbValues.reduce(
(accum, fbVal) =>
val % fbVal.number === 0 ? `${accum}${fbVal.text}` : accum,
''
) || val
)
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
@Zyber17
Zyber17 / continually_copy_events.applescript
Last active August 9, 2023 16:38
Copies events from one calendar to another. Can be continually run.
repeat
tell application "System Events" to set CalIsRunning to (name of processes) contains "Calendar"
tell application "Calendar"
if CalIsRunning is false then
activate
delay 10 # If Calendar isn't running and needs to be launched, the script will fail becuase Calendar isn't ready to accept commands as soon as it's launched.
end if
set workEvents to (get events of calendar "Calendar 1")
set testEvents to (get events of calendar "Calendar 2")
set testEventDates to {}

Keybase proof

I hereby claim:

  • I am zyber17 on github.
  • I am zackary (https://keybase.io/zackary) on keybase.
  • I have a public key whose fingerprint is 8BB1 13B9 436C 5FD0 FC63 D88A 5469 4C69 FB58 3F7F

To claim this, I am signing this object:

@Zyber17
Zyber17 / move_folder.rb
Created January 5, 2014 04:08
A [Maid](https://github.com/benjaminoakes/maid) rule for 'moving' folders and their files. (Only works if there are no subdirectories.)
rule 'Move folders from one directory to another' do
folder_destination = '[the path of the directory to where we want the folder moved]'
if File.directory?(folder_destination) #Let's make sure that the directory we want to move the folder to exists
dir('[the direcotry where we are getting the folder from]').each do |folder| #Let's grab all the potential folders
if File.directory?(folder) #Let's check and see if this item is a folder
file_destination = folder_destination + File.basename(folder) #Let's get the path to the folder we're about to create
mkdir(file_destination) #We need to make the 'moved' folder where we're going to put the files from the original folder
move(dir("#{folder}/*"), file_destination) #Now we can move the files
trash(folder) #Finally, let's trash the original folder
end
@Zyber17
Zyber17 / gist:8233445
Created January 3, 2014 05:45
Remove node_modules
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@Zyber17
Zyber17 / newserver.sh
Created October 5, 2013 16:57
Set up a new nginx/node server
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge
sudo rm -Rf "$(whereis apache2)"
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install nginx nodejs npm g++ -y
ln -s /usr/bin/nodejs /usr/bin/node
npm install forever -g
sudo apt-get update -y
@Zyber17
Zyber17 / app.js
Last active December 22, 2015 04:28
App with setup and clusters
var app, cluster, cpu, cpus, express, http, path, setup;
cluster = require('cluster');
if (cluster.isMaster) {
if (process.env.NODE_ENV === 'setup') {
console.log('Starting setup process.');
express = require('express');