Skip to content

Instantly share code, notes, and snippets.

View smach's full-sized avatar

Sharon Machlis smach

View GitHub Profile
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 2, 2024 05:49
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@elliottmorris
elliottmorris / election_night_live_model.R
Last active January 29, 2024 18:56
A live election-night prediction model using The Economist's pre-election forecast
#' Description
#' This file runs a live election-night forecast based on The Economist's pre-election forecasting model
#' available at projects.economist.com/us-2020-forecast/president.
#' It is resampling model based on https://pkremp.github.io/update_prob.html.
#' This script does not input any real election results! You will have to enter your picks/constraints manually (scroll to the bottom of the script).
#'
#' Licence
#' This software is published by *[The Economist](https://www.economist.com)* under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by *The Economist* are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).
#' The licences include only the data and the software authored by *The Economist*, and do not cover any *Economist* content or third-party data or content made available using the software. More information about licensing, syndication and the copyright of *Economist* content can be fou
library(sf)
library(tigris)
library(tidycensus)
library(tidyverse)
library(mapview)
library(mapboxapi)
library(randomNames)
options(tigris_use_cache = TRUE)
denton <- counties(cb = TRUE) %>%
@Moligaloo
Moligaloo / gist:3850710
Created October 8, 2012 04:22
Send mail with attachment and signature via AppleScript in OS X
tell application "Mail"
set theSubject to "Subject" -- the subject
set theContent to "Content" -- the content
set theAddress to "xxx@163.com" -- the receiver
set theSignatureName to "signature_name"-- the signature name
set theAttachmentFile to "Macintosh HD:Users:moligaloo:Downloads:attachment.pdf" -- the attachment path
set msg to make new outgoing message with properties {subject: theSubject, content: theContent, visible:true}
@anttilipp
anttilipp / Tdata.csv
Created May 19, 2020 18:13
Code and data to reproduce the temperature anomaly animation.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 143 columns, instead of 43. in line 1.
Country,ISOA3,Continent,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019
"Afghanistan","AFG","Asia",-0.325,-0.160,-0.814,-0.773,-0.971,-1.133,-1.123,-0.478,0.088,-0.679,-0.617,-1.107,-0.323,-0.914,-1.006,-0.286,-0.299,-0.759,-0.959,0.192,-0.560,-0.291,0.206,-1.049,-0.403,-0.859,-0.386,-0.973,-0.615,-0.069,-0.620,-0.842,-0.251,-0.432,0.256,0.886,-0.614,-0.067,-0.513,-0.38
library(mapboxapi)
library(tidyverse)
library(sf)
library(patchwork)
city_halls <- c(
"New York" = "City Hall Park, New York, NY 10007",
"Los Angeles" = "200 N Spring St, Los Angeles, CA 90012",
"Chicago" = "121 N La Salle St, Chicago, IL 60602",
"Houston" = "901 Bagby St, Houston, TX 77002",
@noamross
noamross / base_r_plotting_tutorial_koontz_d-rug.r
Created April 24, 2015 17:34
Back to basics: High quality plots using base R graphics
### Title: Back to basics: High quality plots using base R graphics
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015
###
### Date created: 20150418
### Last updated: 20150423
###
### Author: Michael Koontz
### Email: mikoontz@gmail.com
### Twitter: @michaeljkoontz
###
@wch
wch / server.r
Last active September 8, 2023 20:25
Shiny example: dynamic input fields
data_sets <- c("mtcars", "morley", "rock")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# Check boxes
<?php
use Illuminate\Console\Command;
use Pgvector\Laravel\Vector;
use OpenAI\Laravel\Facades\OpenAI;
use App\Models\Document;
class AskQuestion extends Command
{
protected $signature = 'app:ask-question';