Skip to content

Instantly share code, notes, and snippets.

@fenneh
fenneh / gist:d818e38ad71d8a1e8d37
Created January 7, 2016 15:10 — forked from athieriot/gist:5532748
Hipchat with IRSSI

If you are adventurous, here the process to have Hipchat working in your favourite IRC client:

@hassansin
hassansin / eloquent-cheatsheet.php
Last active May 5, 2024 05:53
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
@RadicalZephyr
RadicalZephyr / img-separator.sh
Last active June 25, 2023 21:04
Copy image files from a folder and rename based on type.
#!/usr/bin/env bash
set -e
if [ $# -lt 1 ]
then
echo "You must enter the name of a folder."
exit 1
fi
@romainl
romainl / _rnb.md
Last active August 12, 2021 21:56
RNB, a Vim colorscheme template
@ashwin
ashwin / getopt_long_example.cpp
Last active April 5, 2023 21:42
How to parse options in C++ using getopt_long
#include <getopt.h>
#include <iostream>
int num = -1;
bool is_beep = false;
float sigma = 2.034;
std::string write_file = "default_file.txt";
void PrintHelp()
{
@greglittlefield-wf
greglittlefield-wf / chat-osx-custom.css
Last active February 18, 2016 18:02
Custom HipChat CSS
/* Do font-size on the chat container so all font can respond to zoom. */
.chat_text {
/* These are %-based to enable text size scaling options. The default text size is defined
by a function on the WebPreferences object */
font-size: 100%;
}
p, div, .nameBlock p, .messageBlock p, .messageBlock div, .messageBlock pre {
font-size: inherit;
}
@ericdke
ericdke / notification.swift
Created October 10, 2014 21:01
Deliver an OSX notification with Swift
func showNotification() -> Void {
var notification = NSUserNotification()
notification.title = "Test from Swift"
notification.informativeText = "The body of this Swift notification"
notification.soundName = NSUserNotificationDefaultSoundName
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)
}
//showNotification()
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active April 29, 2024 17:30
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@ernix
ernix / mock_open.pl
Last active April 11, 2019 14:14
Mock(override) built-in `open` function in perl.
#
# http://perldoc.perl.org/CORE.html#OVERRIDING-CORE-FUNCTIONS
# > To override a built-in globally (that is, in all namespaces), you need to
# > import your function into the CORE::GLOBAL pseudo-namespace at compile
# > time:
# >
# > BEGIN {
# > *CORE::GLOBAL::hex = sub {
# > # ... your code here
# > };
@sorbits
sorbits / every
Last active February 22, 2024 03:58
Run «command» only every «number» time invoked
#!/usr/bin/env bash
progname=$(basename $0)
version="1.0 (2014-08-17)"
step=2
function create_hash {
openssl dgst -sha1 -binary <<< "$1" | xxd -p
}