How do I search GitHub issues "created in the last seven days"? - github

We'd like to list all GitHub issues created in the last seven (or, n) days. This is a relative time window.
We don't want to use a specific date, because we'd like to create a link that is always correct (so we can link to the report of recent issues).
Thanks!

According to https://help.github.com/articles/searching-issues/#search-based-on-when-an-issue-or-pull-request-was-created-or-last-updated
created:2016-12-01..2016-12-08
Will output issue created during these 7 days.

You could create a bookmarklet, like I have, to for example, show your merged PRs last 7 days within a repo. Here's my bookmarklet:
javascript:document.location.href%3D%60https://github.com/calcom/cal.com/pulls%3Fq%3Dis%253Apr%2Bauthor%253Aleog%2Bis%253Aclosed%2Bmerged%253A%253E%24%7Bnew Date((new Date).setDate((new Date).getDate()-7)).toISOString().split("T")%5B0%5D%7D%60%3B

Related

RRULE for first Advent

I am currently trying to setup my own holiday iCalendar to which I can subscribe on, since I don't want to depend on 3rd party services.
I am currently trying to make the the VEVENTs for Christmas. The 2nd, 3rd and 4th advent, as well as the Christmas holidays are straight forward, however I have big issues to model the 1st advent.
Specifically, the problem is that the first advent can be in November and December (27th November to 3rd Devember)
How can I make a recurring event (or, more specifically, the RRULE) to cover all cases for the 1st advent?
What I've tried
My first idea was this:
FREQ=YEARLY;INTERVAL=1;BYMONTH=11,12;BYMONTHDAY=27,28,29,30,1,2,3;BYDAY=SU
The idea was to just pick the one Sunday in between 27th November and 3rd December. This does of course not work because BYMONTH expands the search to all days in November and December, and BYMONTHDAY limits the search to those days in both months. I.e. November 1st, November 2nd, ... December 27th, December 28th, ..., which is of course not what I want.
Next, I tried to use BYYEARDAY=331,332,333,334,335,336,337 instead of BYMONTHDAY and BYMONTH, but unfortunately my webdav server (Nextcloud, which uses Sabre as far as I know. I got an error message "Invalid BYYEARDAY rule") does not support this.
My next idea was to use multiple RRULEs -- at least I did not see any passage in the RFC stating that only one RRULE is allowed at most. So I ended up with:
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=SU;BYMONTHDAY=27,28,29,30;BYMONTH=11
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=SU;BYMONTHDAY=1,2,3;BYMONTH=12
Didn't work as well. My last resort was to create two separate VEVENTs, one with the first RRULE above and one with the second RRULE above, but otherwise identical. This worked, but it left me confused.
Is there no better solution? How would you do it?
unfortunately my webdav server (Nextcloud, which uses Sabre as far as I know. I got an error message "Invalid BYYEARDAY rule") does not support this.
Well I think you should raise a bug report, because as far I can tell your solutions are correct and RFC-compliant.
I tried your solutions 2 and 3 with different libs (my own lib php-rrule, and rrule.js) and both options seems to work just fine.
FREQ=YEARLY;BYDAY=SU;BYYEARDAY=331,332,333,334,335,336,337
or combining 2
FREQ=YEARLY;INTERVAL=1;BYDAY=SU;BYMONTHDAY=27,28,29,30;BYMONTH=11
FREQ=YEARLY;INTERVAL=1;BYDAY=SU;BYMONTHDAY=1,2,3;BYMONTH=12
will both produce:
2018-12-02
2019-12-01
2020-11-29
2021-11-28
2022-11-27
2023-12-03
2024-12-01
2025-11-30
2026-11-29
2027-11-28
which according to Google and Wikipedia are the correct dates for the 1st Advent Sunday in the next 10 years.
Side note
at least I did not see any passage in the RFC stating that only one RRULE is allowed at most.
While not strictly forbidden, in RFC 5545 it's literally written everytime RRULE is mentioned:
;
; The following is OPTIONAL,
; but SHOULD NOT occur more than once.
;
rrule
Appendix A even states in the "New restrictions":
2. The "RRULE" property SHOULD NOT occur more than once in a
component.
That being said, multiple RRULE is a great feature, I don't know why they restricted it.
If I'm not mistaken, the first Advent is always the fifth last Sunday in a year. So the following rule should do the trick:
FREQ=YEARLY;BYDAY=-5SU
See the next 10 results: http://recurrence-expansion-service.appspot.com/reaas?dtstart=20181202&rrule=FREQ%3DYEARLY%3BBYDAY%3D-5SU&max_instances=10
Or to put it another way:
FREQ=YEARLY;BYDAY=SU;BYSETPOS=-5

How can I make a google sheets query for dates that fall in "this week"

I'm trying to put a query in one google sheet tab that pulls in data from another tab (Called Confirmed Shoots), based on one "date" column in the Confirmed Shoots tab. I want to pull in anything from the current week, probably taken from the week number (WEEKNUM).
I have a similar formula working in another tab where I'm pulling in everything scheduled for tomorrow, which is:
=query('Confirmed Shoots'!A1:Y,"Select G,J,I,H,C,E,F,K,L,N,D Where G=date"""&text(TODAY()+1,"yyyy-mm-dd")&""" ")
I also found a way to pull "this week" from a date with this IF formula-
=IF(WEEKNUM(G2)=WEEKNUM(NOW()),"Yes","")
I'm struggling with the syntax, trying to combine the two. I want it to be something like:
=query('Confirmed Shoots'!A1:Y,"Select G,J,I,H,C,E,F,K,L,N,D Where (WEEKNUM(G2)=WEEKNUM(NOW()),"yyyy-mm-dd")&""" ")")
or
=query('Confirmed Shoots'!A1:Y,"Select G,J,I,H,C,E,F,K,L,N,D Where (WEEKNUM(G2)=WEEKNUM(NOW())
Both of these are giving me errors though. Does anyone know how to do this? Thanks!
Try:
=FILTER(QUERY('Confirmed Shoots'!A1:Y,"Select G,J,I,H,C,E,F,K,L,N,D"), WEEKNUM('Confirmed Shoots'!G1:G)=WEEKNUM(NOW()))

regarding calculating business days/holidays

does anyone know where I can download this zip file called "businessdays.zip" which was mentioned from this link ... http://www.tek-tips.com/viewthread.cfm?qid=136159 ... I mean is there a better way of calculating business days/holidays than what is previously written here ... http://www.experts-exchange.com/Database/Reporting_/Crystal_Reports/Q_21376129.html ... I've tried this but method from experts-exchange, registered the dll but still not working for me. Can anyone help?
You could create a custom function that returns an array of holidays. See my answer to Crystal Report exclude time entries based on holiday rules.
In this post there is a function that takes a start date, and end date and return the number of working days in between. Also takes holidays into account.

How to make Jasper Reports programmatically determine the Name of Columns within the report it self?

I am generating a report with that will have a 7 columns where the last 6 should have the the last 6 months listed. So as of the time of this writing it should be:
NAME -> September -> August -> July -> June -> May -> April
ss the column headers. I am trying to avoid having to pass them in as parameters, and am trying to get Jasper Reports to figure it out at runtime. I can get the first month pretty easily using a Text Field Expression. It looks like:
new java.text.SimpleDateFormat("MMMMM").format(new Date())
The issue comes in with the other months. I initially tried
new java.text.SimpleDateFormat("MMMMM").format(java.util.Calendar.getInstance().add(Calendar.MONTH, new Integer("-1)).getTime())
This does not work since Calendar.add does not return a Calendar instance. I then tried using a variable and then a combination of variables which also did not work.
How to make Jasper Reports programmatically determine the Name of Columns within the report it self?
I think the best approach to solving this problem is to use Commons Lang. That package provides utilities to make calculations like this very easy. By adding one extra jar you can then use expressions like this:
DateUtils.addMonths(new Date(),-1)
I find that easier to maintain than first creating a helper Calendar class and then using the ternary operator but ignoring its results.
$P{cal}.add(Calendar.MONTH, -1)
? null : $P{cal}.getTime()
If you ever need to generalize the solution then it's a lot easier to get a Date back from a SQL query than to get a Calendar. So you can quickly change to "DateUtils.addMonths($F{MyDate},-1)". Initializing a Calendar to match a date returned by a query isn't nearly as simple. But of course there's a certain benefit to not having to add one more .jar file. So sometimes that ternary operator technique is the quickest way to get things done.
I wrote about using the Commons Lang approach a couple of years ago here: http://mdahlman.wordpress.com/2009/09/09/jasperreports-first-dates/
I also needed a certain format for the previous month. I ended up combining the other two answers:
new java.text.SimpleDateFormat("yyyyMM").format(
org.apache.commons.lang3.time.DateUtils.addMonths(
new java.util.Date(),
-6
)
)
This way I don't need to add another parameter. Adding the Commons Lang jar is a non issue for me since JasperServer 5.5 comes with version 3.0 out of the box.
I hope this helps someone who stumples upon this page, just like I did.
I found a working solution that is pretty ingenious (no I did not come up with it). I found it here. The gist of it is create a parameter called call, with a default value of:
Calendar.getInstance()
and un-check the option 'Use as a prompt'. Then in your text field expression you would do:
new java.text.SimpleDateFormat("MMMMM").format(
(
$P{cal}.add(Calendar.MONTH, -1)
? null : $P{cal}.getTime()
)
)
What happens is it will set the default value for the calendar instance, then execute the add method, which will resolve to false, so then it will then return the result from getTime() method which gets formatted how I want.

Change article_custom so that 'past' doesn't exclude an event on the current date

I'm using textpattern and trying to display a list of upcoming events. I'm using article_custom.
<txp:article_custom
form="eventshome"
limit="4"
time="future"
sort="Posted
section="events" />
The issue I have is that this is supposed to show events coming up but using 'future' means that when an event is on the current date it's not showing (it's not future anymore). Both 'past' and 'future' time options seem to exclude the current date. That means people coming on the site don't see an event on that day which is a bit of an issue.
I've had a quick look around the code but can't seem to work out how to change the SQL statement so that future includes the current date.
Any help appreciated.
Its a bit oldie, but since i've just fixed the same issue, i thought i could provide my very simple soution to this matter.
What i did was simply set article date and time to its date and 25:59:59 time, so its visible all day on current day, but disappears immeadetly when day changes.
Since i didn't want to type those times always again and again, i run small javascript on article page which sets those automaticly to fields.
You can try plugin smd_calendar - http://stefdawson.com/sw/plugins/smd_calendar
it supports a lot of methods to display upcomming and past events.