This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* return the number of zeros immediately proceeding the decimal point for any | |
* (-1 < n < 1) | |
*/ | |
floor(abs(log10(abs(n)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Run this in the Console of the developer tools in whatever browser you are using. | |
* (Usually, you can just hit F12 to open it) | |
*/ | |
var r=window.gameData.googleResults;for(var i=0;i<r.length;i++){$("#rebox").val(r[i]);$("#guess").click()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class RepeatGround : MonoBehaviour | |
{ | |
public GameObject surfacePrefab; | |
public GameObject soilPrefab; | |
public Vector2 widthRange = new Vector2(-100, 100); | |
public int numLayers = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = x + (y * w) | |
x = i % w | |
y = i / w |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias screen_open "+remote_view; bind TAB screen_close"; alias screen_close "-remote_view; bind TAB screen_open"; bind TAB "screen_open" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SWAP(x,y) do{ x^=y; y^=x; x^=y; } while (0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Randomly chooses a file from the given directory. | |
* @param directory Optional. The directory to search. Defaults to the current directory. | |
* @param ext Optional. An array of accepted file extensions to match. Defaults to standard images. | |
* @return A string representing the name of the file | |
*/ | |
function randomFile($directory = ".", $ext = array("jpg", "jpeg", "gif", "png", "bmp")) { | |
// Find file matches using glob | |
$files = glob($directory."/*.{".implode(",",$ext)."}", GLOB_BRACE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool is_even(int i) { | |
char buf[10]; // Probably big enough | |
float f = (float)i; | |
f /= 2; | |
sprintf(buf, "%lf", f); | |
for (int ii = 0; ii < 10 - 1; ++ii) { | |
if (buf[ii] == '.' && buf[ii+1] == '5') { | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> | |
/// Represents a behavior script which will cause the object to float following a sine wave pattern. | |
/// </summary> | |
public class FloatObject : MonoBehaviour | |
{ | |
[SerializeField] private float _amplitude = 0.25f; | |
[SerializeField] private float _frequency = 1f; | |
private float _t = 0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
if(argc == 1) | |
printf("Whose birthday is it?\n"); | |
else if (argc == 2) | |
for(int i = 1; i <= 4; i++) | |
printf("Happy birthday %s %s\n", i % 3 == 0 ? "dear" : "to", i % 3 == 0 ? argv[1] : "you"); | |
else | |
printf("Too many.\n"); |