Skip to content

Instantly share code, notes, and snippets.

{
"id": 1,
"name": "foo",
"city": "London",
"postcode": "SW66LG",
"items": [
{
"name": "Pizza",
"qty": 3
},
@ronaldronson
ronaldronson / update.sh
Created November 14, 2017 09:00
Update mac deps
#!/bin/bash
brew update
brew upgrade
brew cleanup -s
brew cask cleanup
#now diagnotic
brew doctor
brew missing
/opt/bin/updateCCTF.sh && terminal-notifier -message "git pull done :-)" -title "CCTF up to date"
echo "you can hit mas upgrade to upgrade theses apps from the app store:"
@ronaldronson
ronaldronson / headsAndLegs.js
Last active August 7, 2017 10:32
Question 2 of 3 It’s the middle of the day, and Andrew wants to have a lunch, but he can leave only after contacting the supplier (a farmer) about missing ingredients. Andrew needs you to crack the code to find out the available food supply on the eco-farm he’s working with.
// There are pigs and chickens on a farm.
// Someone has counted the legs and heads
// of all the pigs and chickens.
// The task is to calculate the number
// of pigs and chickens on the farm
// knowing number of heads and legs.
function headsAndLegs (heads, legs) {
var pigs = legs / 4, chickens = 0;
@ronaldronson
ronaldronson / main.rb
Last active July 24, 2017 14:23
Compare page sizes
require 'net/https'
require 'nokogiri'
class MenuSize
attr_accessor :url_list
def get_urls
file = File.read("menus.1.xml")
xml = Nokogiri::XML(file)
@ronaldronson
ronaldronson / scrollPoint.js
Created June 1, 2017 15:08
scrollPoint like Waypoint
function scrollPoint($elems, fn) {
function debounce(fn) {
var tmid;
return function debouncer() {
var args = arguments, that = this;
clearTimeout(tmid);
tmid = setTimeout(function () {
fn.apply(that, args);
}, 50);
@ronaldronson
ronaldronson / settings.json
Last active March 8, 2017 16:16
VSCode settings
{
"git.confirmSync": false,
"files.autoSave": "afterDelay",
"workbench.activityBar.visible": true,
// "workbench.editor.enablePreview": false,
"debug.inlineValues": true,
"php.suggest.basic": false,
// "explorer.autoReveal": false,
"workbench.colorTheme": "Default Light+",
"workbench.iconTheme": "file-icons-colourless",
@ronaldronson
ronaldronson / keybindings.json
Created January 30, 2017 09:25
VS Code key bindings
// Place your key bindings in this file to overwrite the defaults
[{
"key": "shift+cmd+]",
"command": "workbench.action.nextEditor"
}, {
"key": "shift+cmd+[",
"command": "workbench.action.previousEditor"
}, {
"key": "cmd+d",
"command": "editor.action.copyLinesUpAction"
@ronaldronson
ronaldronson / .vscode|launch.json
Created January 17, 2017 12:20
visual studio code php debugger settings
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9001,
"localSourceRoot": "${workspaceRoot}/",
"serverSourceRoot": "/var/www/deploy/local"
@ronaldronson
ronaldronson / .vimrc
Created January 12, 2017 20:27
.vimrc
syntax on
highlight Normal ctermfg=grey ctermbg=black
set ruler " show the line number on the bar
set more " use more prompt
set autoread " watch for file changes
set number " line numbers
// Examples from http://boredzo.org/pointers/
#include <stdio.h>
#include <cstring>
struct User {
size_t size;
char name[64];
int answer_to_ultimate_question;
unsigned shoe_size;